Apache多站点

时间:2012-02-13 18:19:06

标签: apache apache2

我创建了两个虚拟主机。 tester.ly和tucnak.me

/位点可用/实验室:

<VirtualHost tucnak.me:80>
    ServerAdmin kovalevskiy11@gmail.com
    ServerName tucnak.me
    DocumentRoot /home/tucnak/Web/Lab/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/tucnak/Web/Lab/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
            #... here smth skipped.
</VirtualHost>

和/ sites-available / Tester:

<VirtualHost tester.ly:80>
    ServerAdmin kovalevskiy11@gmail.com
    ServerName tester.ly
    DocumentRoot /home/tucnak/Web/Tester/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/tucnak/Web/Tester/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
            # skipped too.
</VirtualHost>

我的apache2输出:

[Mon Feb 13 20:17:07 2012] [warn] VirtualHost tucnak.me:80 overlaps with VirtualHost tester.ly:80, the first has precedence, perhaps you need a NameVirtualHost directive

我认为错误的指令导致了这个问题。所以,我需要帮助。

1 个答案:

答案 0 :(得分:0)

您的配置中可能有NameVirtualHost *:80NameVirtualHost *指令。

这意味着您的首发VirtualHost指令应为:

<VirtualHost *:80>
(...)
<VirtualHost *:80>
(...)

而不是:

<VirtualHost tester.ly:80>
(...)
<VirtualHost tucnak.me:80>
(...)

VirtualHost的名称由VirtualHost中的ServerName指令给出,而不是<VirtualHost xxx>中使用的名称。此xxx应与主配置中的NameVirtualHost声明之一匹配。