2011-08-05 140 views
0

我有一個站點設置在本地主機上,我正在積極開發,並且我想在本地主機上設置一個子域名以使我的生活更輕鬆。阿帕奇虛擬主機無法正常工作子域

我說這C:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost i1.localhost:80> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/i1/" 
    ServerName i1.localhost 
    ServerAlias www.i1.localhost 
    ErrorLog "logs/dummy-host2.localhost-error.log" 
    CustomLog "logs/dummy-host2.localhost-access.log" combined 
</VirtualHost> 

Apache的精細統計起來,但是當我瀏覽到http://localhost/我看到從i1子域的內容。然而,http://i1.localhost/工作正常。

然後我試着這樣做:

<VirtualHost localhost:80> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/" 
    ServerName localhost 
    ServerAlias www.localhost 
    ErrorLog "logs/dummy-host2.localhost-error.log" 
    CustomLog "logs/dummy-host2.localhost-access.log" combined 
</VirtualHost> 

<VirtualHost i1.localhost:80> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/i1/" 
    ServerName i1.localhost 
    ServerAlias www.i1.localhost 
    ErrorLog "logs/dummy-host2.localhost-error.log" 
    CustomLog "logs/dummy-host2.localhost-access.log" combined 
</VirtualHost> 

但是,工作的對面。在localhosti1.localhost我看到來自C:/xampp/htdocs/的內容。

任何人都知道發生了什麼問題?

乾杯。

回答

0

阿帕奇通常不喜歡另一個虛擬主機內的虛擬主機文檔根,嘗試:

的DocumentRoot 「C:/ XAMPP/htdocs中/」

的DocumentRoot「C:/ XAMPP/I1 /「