我有一台服务器,其中有很多域,其中一个是受 SSL 保护的。
如果我将任何其他域与 https://一起使用,它会显示 ssl 安全站点的内容。
在我的 session 中我使用
<VirtualHost *:443>
ServerName www.example.com
DocumentRoot /home/domains/example.com/web/public/www/
SSLEngine on
SSLCertificateFile /home/domains/example.com/web/ssl/www.example.com.crt
SSLCertificateKeyFile /home/domains/example.com/web/ssl/www.example.com.key
SSLCertificateChainFile /home/domains/example.com/web/ssl/www.example.com.ca
# SSLCACertificateFile /home/domains/example.com/web/ssl/www.example.com.ca
ErrorLog /home/domains/example.com/web/log/error.log
CustomLog /home/domains/example.com/web/log/access.log combined
</VirtualHost>
我发现可能是问题所在,但我没有找到任何解决方法。
有人可以告诉我如何解决它,或者指导我查看适当的文档吗?
谢谢。
最佳答案
可能是因为
ServerName inheritance
It is best to always explicitly list a ServerName in every name-based virtual host. If a VirtualHost doesn't specify a ServerName, a server name will be inherited from the base server configuration. If no server name was specified globally, one is detected at startup through reverse DNS resolution of the first listening address. In either case, this inherited server name will influence name-based virtual host resolution, so it is best to always explicitly list a ServerName in every name-based virtual host.
因此尝试使用此条目显式定义 ServerName 条目
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /www/domain
</VirtualHost>
关于Apache 将所有网站重定向到一个域,如果有 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26118474/