測試環境若沒有購買憑證,可自行建立自簽憑證。
yum install openssl
注意不要安裝 mod_ssl,以免影響既有 Apache 版本。
openssl genrsa -out server.key 1024 openssl req -new -key server.key -out server.csr openssl x509 -days 365 -req -in server.csr -signkey server.key -out server.crt
將 server.key 與 server.crt 放到 Apache conf 目錄,編輯 httpd.conf 啟用:
Include conf/extra/httpd-ssl.conf
在 httpd-ssl.conf 中設定 SSLCertificateKeyFile 與 SSLCertificateFile,並確認 Listen 443 與 DocumentRoot。
重啟 Apache 即可測試 HTTPS。