標籤:path localhost pen chain val command led 檔案的 第三方
1. 前提是 已通過第三方 申請到 .crt .key 和 .ca-bundle 檔案
2. 將三個檔案拷貝到linux伺服器上 任意一個指定的目錄
3. 找到要編輯的apache配置
Apache主設定檔通常叫做 httpd.conf 或 apache2.conf. 常見路徑包括 /etc/httpd/ 或 /etc/apache2/
SSL 憑證配置通常位於一個不同的設定檔的 <VirtualHost> 區塊內. 設定檔可能位於諸如/etc/httpd/vhosts.d/, /etc/httpd/sites/目錄, 或在一個叫做httpd-ssl.conf的檔案裡.
4. 找到VirtualHost 模組進行配置
<VirtualHost *:443>DocumentRoot /var/www/html2ServerName www.yourdomain.comSSLEngine onSLCertificateFile /path/to/your_domain_name.crtSSLCertificateKeyFile /path/to/your_private.keySSLCertificateChainFile /path/to/ComodoCA.crt</VirtualHost>
5. 測試 apache config
apachectl configtest
6. 重啟apache
systemctl restart httpd
順利的情況下基本已經ok了
但更多的時候是無法重啟 遇到問題
常見問題如下:
1. Invalid command ‘SSLEngine‘, perhaps misspelled or defined by a module not included in the server configuration
這個表示 ssl 需要 mod_ssl模組支援 需安裝 (指令 yum install mod_ssl ,一般系統會內建openssl)
2.
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using 10.29.179.155. Set the ‘ServerName‘ directive globally to suppress this mes sage
這個是因為 主 apache 的 httpd.conf 配置 缺少 ServerName localhost:80, 找到 ServerName 並加上
3. 如何相容 http 只需要將原來的 vhost.conf 裡的東西保留 同時加上ssl的文章上面所述配置內容 即可
4. 注意 每修改一次 配置 需要重啟一次 apache
linux ssl認證配置(apache)