我正在运行Ubuntu 12.10,并且在/etc/apache2/apache2.conf有以下4个VirtualHost条目
这4个VirtualHost条目用于2个独立的站点, test2.example.com和test2.example.com ,其中一个用于HTTP,一个用于HTTPS。
<VirtualHost *:443> DocumentRoot /var/www/test ServerName test.example.com # Other settings goes here </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/test ServerName test.example.com # Other settings goes here </VirtualHost> <VirtualHost *:443> DocumentRoot /var/www/test2 ServerName test2.example.com # Other settings goes here </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/test2 ServerName test2.example.com # Other settings goes here </VirtualHost>
我的问题当我保存并重新启动Apache,我得到这个警告: –
*重新启动Web服务器apache2 [Sun Feb 17 18:30:09 2013] [warn] _default_ VirtualHost在端口443重叠,第一个优先 等待[Sun Feb 17 18:30:10 2013] [warn] _default_ VirtualHost在端口443重叠,第一个优先
当我打开test2.example.com和test2.example.com时,我会得到/var/www/test的内容
任何想法是什么问题?
你需要添加NameVirtualHost *:443才能工作。
NameVirtualHost *:80也必须在您的configuration中,它可能是默认设置,但我不使用Ubuntu,所以我不知道在哪个文件。
另外一个build议的话:
在单个IP上运行多个HTTPS站点可能会有缺点,特别是较老的客户端(IE8 / Windows XP)将不支持SNI。
在您的情况下,这可能会非常有意义(仅用于testing,正在使用* .example.com通配符证书等),但您应该知道这一点。