我最近将我的 ubuntu 服务器更新到 10.04 并且我的虚拟主机设置不再正常工作。
我从我的服务器托管两个站点,并且在更新之前正确链接到各自站点的地址,但之后两个地址都链接到同一个站点,即使我没有对可用站点进行任何更改并且两个站点都已启用。
我的设置是这样的:
在 /etc/apache2/sites-available/ 我有两个配置文件:“www.site1.com”和“www.site2.com”
这些配置文件设置如下:
<VirtualHost *:80>
ServerAdmin admin@site1.com
ServerName www.site1.com
ServerAlias site1.com
# Indexes + Directory Root.
# DirectoryIndex index.html index.htm index.php
DocumentRoot /home/www/www.site1.com/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.site1.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/www.site1.com/logs/error.log
CustomLog /home/www/www.site1.com/logs/access.log combined
</VirtualHost>
此外,我在 /etc/apache2/ports.conf 中有以下设置:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
NameVirtualHost *:443
Listen 443
</IfModule>
我唯一的线索是当我重新启动 apache 时出现以下错误:
[warn] NameVirtualHost *:443 has no VirtualHosts
[warn] NameVirtualHost *:80 has no VirtualHosts