1. 程式人生 > >阿里雲Ubuntu Apache環境配置多域名證書,實現不同域名部署不同SSL證書

阿里雲Ubuntu Apache環境配置多域名證書,實現不同域名部署不同SSL證書

新手村玩家 這篇文章完美的解決了我的問題 轉載儲存

Apache環境配置多域名證書,實現不同域名部署不同SSL證書

釋出時間:2016/12/30 1:35:29

要實現Apache伺服器不同域名部署不同SSL證書,您需要支援SNI(Server Name Indication),也就意味著您需要滿足以下條件:

(1)apache 2.2.12以上版本

(2)openssl 0.9.8f以上版本

首先您需要知道如何在Apache上部署SSL證書,請查閱Apache SSL證書部署指南。

下面來看下Apache伺服器如何實現不同域名部署不同SSL證書。

您可以將所有站點配置部署在一個配置檔案下,也可以分別新增在各個站點配置檔案下。

參考以下配置:

<NameVirtualHost *:443>

listen 443

----------------------------------------------------------------------------------------

<VirtualHost *:443>

ServerName www.yoursite.com

DocumentRoot /var/www/site

SSLEngine on

SSLProtocol all -SSLv2 -SSLV3

SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!aNULL:!eNULL

SSLCertificateFile /path/to/2_domain1.com.crt

SSLCertificateKeyFile /path/to/3_doamin1.com.key

SSLCertificateChainFile /path/to/1_root_bundle.crt

</VirtualHost>

----------------------------------------------------------------------------------------

<VirtualHost *:443>

ServerName www.yoursite2.com

DocumentRoot /var/www/site2

SSLEngine on

SSLProtocol all -SSLv2 -SSLV3

SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!aNULL:!eNULL

SSLCertificateFile /path/to/2_domain2.com.crt

SSLCertificateKeyFile /path/to/3_doamin2.com.key

SSLCertificateChainFile /path/to/1_root_bundle.crt

</VirtualHost>

最後重啟Apache伺服器。

當您用瀏覽器訪問時,請注意您的瀏覽器版本是否支援SNI功能,請查閱支援SNI的瀏覽器

原文連結https://www.gworg.com/ssl/255.html