2013-05-08 177 views
0

我在Windows窗口中安裝了XAMPP - 我嘗試在虛擬主機文件中運行多個網站,但無論我看起來如何,我一次只能運行一個站點。例如運行網站三,我需要註釋掉所有對網站1 & 2的引用(反之亦然)。在虛擬主機(apache)中使用多個站點

任何人都可以解釋我做錯了什麼?

我的V/hosts文件如下:

<VirtualHost *:80> 
ServerName s1.localhost 
ServerAlias s1.localhost 
DocumentRoot "C:/xampp/htdocs/site1/public_html" 
<Directory "C:/xampp/htdocs/site1/public_html"> 
    AllowOverride All 
    Options FollowSymlinks 
    Order allow,deny 
    Allow from all 
</Directory> 

<VirtualHost *:80> 
ServerName s2.localhost 
ServerAlias s2.localhost 
DocumentRoot "C:/xampp/htdocs/site2/public_html" 
<Directory "C:/xampp/htdocs/site2/public_html"> 
    AllowOverride All 
    Options FollowSymlinks 
    Order allow,deny 
    Allow from all 
</Directory> 

<VirtualHost *:80> 
ServerName s3.localhost 
ServerAlias s3.localhost 
DocumentRoot "C:/xampp/htdocs/site3" 
<Directory "C:/xampp/htdocs/site3"> 
    AllowOverride All 
    Options FollowSymlinks 
    Order allow,deny 
    Allow from all 
</Directory> 

我的Windows主機文件:

127.0.0.1 s1.localhost 
127.0.0.1 s2.localhost 
127.0.0.1 s3.localhost 

回答

0

了NameVirtualHost *:80 - 這條線需要被註釋掉來解決這個問題

+0

http://httpd.apache.org/docs/2.2/en/vhosts/name-based.html – 2013-05-08 12:29:16