将 ubuntu 服务器升级到 10.04 后如何修复虚拟主机设置
我最近将 ubuntu 服务器更新到 10.04,但我的虚拟主机设置不再正常工作。
我从我的服务器托管两个站点,在更新之前,地址正确链接到各自的站点,但之后两个地址都链接到同一个站点,即使我没有对可用站点进行任何更改并且两个站点都已启用。
我的设置是这样的:
在 /etc/apache2/sites-available/ 中我有两个配置文件: “www.site1.com”和“www.site2.com”
的配置文件设置如下:
<VirtualHost *:80>
ServerAdmin [email protected]
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
I recently updated my ubuntu server to 10.04 and my virtualhost setup no longer working correctly.
I host two sites from my server and before the update the addresses linked correctly to their respective sites, but afterwards both addresses link to the same site, even though I have not made any changes to sites-available and both sites are enabled.
My setup is like this:
In /etc/apache2/sites-available/ I have two configuration files:
"www.site1.com" and "www.site2.com"
thes configuration files are setup as follows:
<VirtualHost *:80>
ServerAdmin [email protected]
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>
in addition I have the following setup in /etc/apache2/ports.conf:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
NameVirtualHost *:443
Listen 443
</IfModule>
The only clue I have is when I restart apache I get the following errors:
[warn] NameVirtualHost *:443 has no VirtualHosts
[warn] NameVirtualHost *:80 has no VirtualHosts
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能过于简单化,但是您是否运行 a2ensite 来创建返回站点可用文件夹的符号链接?
IE:
a2ensite www.site1.com
如果我没记错的话,配置文件不会从可用站点读取,只能从启用站点(从站点启用到站点可用的符号链接)读取,并且可能是警告的来源,因为 Apache读取配置文件时没有看到任何虚拟主机被创建。
This may be way to simplistic, but have you run a2ensite to create the symlinks back to the site-available folders?
ie:
a2ensite www.site1.com
If I remember correctly, the configuration files aren't read from sites-available, only from site-enabled (the symlinks from sites-enables to sites-available) and could be the source of your warnings because Apache is not seeing any VirtualHosts being created when the configuration files are read.