作者lovejoe7010 (shen)
看板ask
標題[請問] apache VirtualHost 443 多組網域
時間Thu Mar 7 13:21:55 2019
小妹在httpd設定的兩組網域
但當我輸入第二組網址
https://www.b.com/時
會顯示憑證只對 *.a.com 有效,新增為例外網站後
網站內容會顯示
https://www.a.com/的網站
看似都指向到了第一組VirtualHost
嘗試把第一組跟第二組VirtualHost互調位子,結果會反過來變成第一組網址失效
解了好久始終沒有解決....還請大大們幫幫小妹....
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot "C:/web/a"
ServerName *.a.com
ServerAdmin *.a.com
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCertificateFile "C:/test/apache/conf/ssl.crt/certificate.crt"
SSLCertificateKeyFile "C:/test/apache/conf/ssl.crt/private.key"
SSLCACertificateFile "C:/test/apache/conf/ssl.crt/ca_bundle.crt"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/web/a">
Options FollowSymLinks
AllowOverride All
SSLOptions +StdEnvVars
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$
https://%{SERVER_NAME}
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName *.b.com
ServerAdmin *.b.com
DocumentRoot "C:/web/b"
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCertificateFile "C:/test/apache/conf/ssl.crt/certificate2.crt"
SSLCertificateKeyFile "C:/test/apache/conf/ssl.crt/private2.key"
SSLCACertificateFile "C:/test/apache/conf/ssl.crt/ca_bundle2.crt"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/web/b">
Options FollowSymLinks
AllowOverride All
SSLOptions +StdEnvVars
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$
https://%{SERVER_NAME}
</Directory>
</VirtualHost>
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.116.52.39
※ 文章網址: https://www.ptt.cc/bbs/ask/M.1551936119.A.B2D.html
推 chang505: apachectl -S 會看到什麼? 03/07 13:46
推 Schottky: 因為憑證(certificate)是註冊給 a.com 用的,b.com 不准 03/07 14:25
→ Schottky: 盜用,你要這樣做 b.com 也得去申請一個 certificate 03/07 14:25
→ lovejoe7010: 兩個網址都各自申請好憑證了 03/07 15:47
→ lovejoe7010: 只是都抓第一組的 03/07 15:48