Apache-2.2

具有各種主機和 http/https 的虛擬主機

  • July 22, 2013

我在我的 vhosts.d 目錄下有一個文件,它被稱為 hosts.conf (從我收集的名稱來看,這不是問題)。現在有各種主機,如您所見,如果我使用 http(埠 80)完全沒有問題,我可以從一個網站反彈到另一個網站,但如果我使用 https(埠 443),無論我在瀏覽器中輸入什麼網站,我總是最終進入首先列出 443 埠的網站(在本例中為 mobile-dev1. *.it)。顯然,我的真實文件沒有寫 * 而是正確的網站名稱。

<VirtualHost 10.65.200.7:80>
   DocumentRoot "/srv/www/htdocs/public"
   ServerName portal.***.it
   <Directory "/srv/www/htdocs/public">
       allow from all
   </Directory>
</VirtualHost>

<VirtualHost 10.65.200.7:80>
DocumentRoot /srv/mobile-dev1/public
ServerName mobile-dev1.***.it
<Directory /srv/mobile-dev1/public>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost 10.65.200.7:443>
DocumentRoot /srv/mobile-dev1/public
ServerName mobile-dev1.***.it
   SSLEngine on
   SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
   SSLCertificateFile    /etc/ssl/certs/wildcard_***_it.pem
   SSLCertificateKeyFile /etc/ssl/private/wildcard_***_it.key
   SSLCertificateChainFile /etc/ssl/certs/RapidSSLCA.crt
<Directory /srv/mobile-dev1/public>
allow from all
Options +Indexes
</Directory>

<VirtualHost 10.65.200.7:80>
DocumentRoot /srv/mobile-dev2/public
ServerName mobile-dev2.***.it
<Directory /srv/mobile-dev2/public>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost 10.65.200.7:443>
DocumentRoot /srv/mobile-dev2/public
ServerName mobile-dev2.***.it
   SSLEngine on
   SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
   SSLCertificateFile    /etc/ssl/certs/wildcard_***_it.pem
   SSLCertificateKeyFile /etc/ssl/private/wildcard_***_it.key
   SSLCertificateChainFile /etc/ssl/certs/RapidSSLCA.crt
<Directory /srv/mobile-dev2/public>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost 10.65.200.7:80>
DocumentRoot /srv/mobile-test/public
ServerName mobile-test.***.it
<Directory /srv/mobile-test/public>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost 10.65.200.7:443>
DocumentRoot /srv/mobile-test/public
ServerName mobile-test.***.it
   SSLEngine on
   SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
   SSLCertificateFile    /etc/ssl/certs/wildcard_***_it.pem
   SSLCertificateKeyFile /etc/ssl/private/wildcard_***_it.key
   SSLCertificateChainFile /etc/ssl/certs/RapidSSLCA.crt
<Directory /srv/mobile-test/public>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

謝謝你的幫助,這個問題讓我發瘋,因為它可能很簡單..

有兩件事浮現在腦海:

  • 你沒有NameVirtualHosts指令。它可能在您的其他配置文件之一中,但您需要NameVirtualHosts 10.65.200.7:443某個地方才能使其工作。
  • 您可能正在使用不支持SNI的瀏覽器。如果沒記錯的話,XP 下沒有任何版本的 IE 支持 SNI。您需要這個,因為您有多個共享 IP 地址的 SSL 虛擬主機,而網路伺服器可以區分它們的唯一方法是使用 SNI。

引用自:https://serverfault.com/questions/525227