2017-06-05 81 views
-1

我正在接管一個多站點Apache服務器,其中包含兩個網站(A和B)。通過http去網站A的網址工作正常。轉到相同的網址,但使用https,顯示網站B.爲什麼是這樣的,我該如何讓https://urlA.com轉到網站A?HTTP vs HTTPS上的其他站點

+0

發佈服務器配置。這可能與如何定義服務器塊有關。 –

回答

1

我解決了這個問題。

的服務器都設置了VirtualHosts,但沒有虛擬主機的端口443所以它看起來是這樣的:

<VirtualHost 99.9.9.999:80> 
DocumentRoot /var/www/example 
ServerName example.com 

    <Directory "/var/www/example"> 
      Options Indexes 
      AllowOverride None 
      DirectoryIndex index.php index.html 
      Order allow,deny 
      Allow from all 
    </Directory> 

添加一個虛擬主機偵聽端口443,與SSLCertFiles指定解決問題。

<VirtualHost 99.9.9.999:443> 
DocumentRoot /var/www/example 
ServerName example.com 

    <Directory "/var/www/example"> 
      Options Indexes 
      AllowOverride None 
      DirectoryIndex index.php index.html 
      Order allow,deny 
      Allow from all 
    </Directory> 

SSLCertificateFile /etc/httpd/conf/example.crt 
SSLCertificateKeyFile /etc/httpd/conf/_.example.key 
SSLCertificateChainFile /etc/httpd/conf/gd_example.crt 
SSLEngine on 

</VirtualHost> 
相關問題