linux ssl認證配置(apache)

來源:互聯網
上載者:User

標籤: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)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.