我正在接管一个多站点 Apache 服务器,它有两个网站(A 和 B)。通过 http 访问网站 A 的 url 可以正常工作。转到相同的 url,但使用 https,显示网站 B。这是为什么,我如何制作 https://urlA.com去网站A?
最佳答案
我解决了这个问题。
服务器设置了 VirtualHosts,但是端口 443 没有 VirtualHost。所以它看起来像这样:
<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>
添加一个 VirtualHost 监听端口 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>
关于apache - HTTP 与 HTTPS 的不同站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44375123/