1

我最近将我的 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
4

1 回答 1

1

这可能是一种简单化的方式,但是您是否运行 a2ensite 来创建指向站点可用文件夹的符号链接?

即:a2ensite www.site1.com

如果我没记错的话,配置文件不是从可用站点读取的,只能从启用站点(从站点启用到站点可用的符号链接)读取,并且可能是警告的来源,因为 Apache 没有看到任何 VirtualHosts读取配置文件时创建。

于 2012-03-19T17:16:50.440 回答