好的,我有一个Apache服务器设置了以下指令:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias *.example2.com
DocumentRoot /var/www/example2
</VirtualHost>
<VirtualHost example1.com:443>
DocumentRoot /var/www/html
ServerName example1.com:443
SSLEngine on
...
</VirtualHosts>因此example1.com具有SSL支持,可以通过http:// example1.com或https:// example1.com访问。但是,当我在浏览器中访问https:// example2.com时,这会产生意外的副作用,即显示https:// example1.com。我想要做的基本上是禁用https:// example2.com,或者将其重新定向到http:// example2.com,这样当我访问它时就不会收到警告和错误的站点。
发布于 2013-02-23 09:06:41
您将无法避免收到警告,除非example1和example2位于不同的IP地址上,或者您获得了包含两个名称的SSL证书--直到建立了SSL连接之后才能发生错误页或重定向。
话虽如此,这样的东西应该能发挥作用:
NameVirtualHost *:443
<VirtualHost *:443>
ServerName example1.com
SSLEngine on
#...
</VirtualHost>
<VirtualHost *:443>
ServerName example2.com
SSLEngine on
# same certificate config here as on example1, unless you're wanting to use TLS SNI
# then, let's redirect the user to non-SSL
Redirect permanent / http://example2.com/
</VirtualHost>发布于 2013-02-23 07:35:43
我认为你不应该把:443放在ServerName example1.com上:443
这些应该是正确的配置
<VirtualHost example1.com:443> //change example1.com to ip address is a good habit
DocumentRoot /var/www/html
ServerName example1.com
SSLEngine on
...
</VirtualHosts>发布于 2013-02-26 12:24:06
您需要有服务器名称指示(SNI)来完成这一任务。有关详细信息,请参阅链接:http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI。
https://serverfault.com/questions/481738
复制相似问题