在一臺主機上放置一個https網站,究竟該怎麼配置?對於IIS和Apache以及Nginx等不一樣的服務器,方法是不一樣的,網上有不少教程,在此就再也不贅述了。php
至於一臺主機,如何配置多個https網站呢?有如下幾種方法:html
通配符證書每每價格比較貴,對一些大公司很適合。而對於不少小站長來講,使用普通證書能夠省下來不少費用。apache
配置方法較簡單,和http網站虛擬主機相似,只不過這些網站公用一個證書。服務器
證書安裝方式,能夠諮詢證書頒發機構,或者本身配置IIS或Apache等服務器軟件。網站
假若有2個域名aaa.com和bbb.com。ui
首先,購買兩個域名相應的證書。spa
其次,配置httpd-ssl.conf文件,舉例:code
Listen 443
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLPassPhraseDialog builtin
SSLSessionCache "shmcb:C:/wamp/bin/apache/apache2.4.9/conf/ssl/logs/ssl_scache(512000)" SSLSessionCacheTimeout 300 <VirtualHost _default_:443> DocumentRoot "c:/wamp/www/aaa" #網站根目錄 ServerName aaa.com:443 #主機名 ServerAdmin admin@aaa.com #管理員郵箱 ErrorLog "C:/wamp/bin/apache/apache2.4.9/logs/error_aaa.log" TransferLog "C:/wamp/bin/apache/apache2.4.9/logs/access_aaa.log" SSLEngine on #注意如下證書文件路徑!!! SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/ssl_aaa/public.crt" SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/ssl_aaa/private.key" SSLCACertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/ssl_aaa/ca-bundle.crt" </VirtualHost> <VirtualHost _default_:443> DocumentRoot "c:/wamp/www/bbb" #網站根目錄 ServerName bbb.com:443 #主機名 ServerAdmin admin@aaa.com #管理員郵箱 ErrorLog "C:/wamp/bin/apache/apache2.4.9/logs/error_bbb.log" TransferLog "C:/wamp/bin/apache/apache2.4.9/logs/access_bbb.log" SSLEngine on #注意如下證書文件路徑!!! SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/ssl_bbb/public.crt" SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/ssl_bbb/private.key" SSLCACertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/ssl_bbb/ca-bundle.crt" <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "C:/wamp/bin/apache/apache2.4.9/cgi-bin"> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-5]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog "C:/wamp/bin/apache/apache2.4.9/logs/ssl_request.log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost>
配置好後,就能夠經過 https://aaa.com 和 https://bbb.com 訪問這兩個網站。htm