openssl req -new -nodes -keyout private.key -out public.csr
依提示填寫:
www.example.com**,必須精確匹配。將 public.csr 內容貼至 CA 申請頁面 (如 demo.sheca.com 免費 15 天測試憑證),下載簽署後的憑證 public.der (或 .crt/.pem)。
# 放置於 Apache 可讀目錄
/etc/ssl/crt/public.der
/etc/ssl/crt/private.key
# 載入 SSL 模組 (若未預設載入)
LoadModule ssl_module modules/mod_ssl.so
# 監聽 443
Listen 443
DocumentRoot "/var/www/html"
ServerName www.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/crt/public.der
SSLCertificateKeyFile /etc/ssl/crt/private.key
# 若有中繼 CA
# SSLCertificateChainFile /etc/ssl/crt/ca_bundle.crt
apachectl stop
apachectl startssl # 或 apachectl start (現代版整合啟動)
# 瀏覽器訪問 https://www.example.com 驗證綠鎖
private.key **嚴禁洩露**,權限 chmod 600、擁有者 root:root。SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1、SSLCipherSuite HIGH:!aNULL:!MD5:!3DES、SSLHonorCipherOrder on、HSTS 標頭。