2012-02-13 94 views
0

我創建了兩個虛擬主機。 tester.ly和tucnak.meApache多站點

/網站可用/實驗室:

<VirtualHost tucnak.me:80> 
    ServerAdmin [email protected] 
    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> 

和/站點可用/測試儀:

<VirtualHost tester.ly:80> 
    ServerAdmin [email protected] 
    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 

我認爲錯誤的指令會導致這個問題。所以,我需要幫助。

回答

0

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

這意味着你的出發VirtualHost指令應是:

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

而不是:

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

的虛擬主機的名稱由虛擬主機內部的ServerName指令給定,而不是由所使用的名稱在<VirtualHost xxx>。並且這個xxx應該匹配主配置中的NameVirtualHost聲明之一。