2017-07-15 114 views
0

我希望配置我的XAMPP有2個不同的localhosts和站點,2個不同的根目錄2個站點不同XAMPP根目錄

讓我們命名他們:1和Site2

但是當我嘗試接取的SITE1的URL(例如:111.111.111.111:8090)他把我的文件夾選擇

我解決了問題,把httpd.conf文件根目錄放在我的SITE1目錄根目錄「C:/ xampp/htdocs/SITE1「),但現在是問題所在,有什麼方法可以解決SITE2的問題?

我想訪問SITE2的URL,例如:111.111.111.111:8091(因爲我想指向某個域的DNS)並直接轉到目錄「C:/ xampp/htdocs/SITE2」而不是文件夾選擇

+0

如果你認爲你已經找到你要找的答案,請在下面標記爲接受的答案(S) 。參考:https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – eeya

回答

0

打開與記事本++:C:\ XAMPP \阿帕奇\ CONF \的httpd.conf

添加此線下聽80

Listen 8090 
Listen 8091 

打開與記事本++:C:\ XAMPP \ apache的\ conf \ extra \ httpd -vhosts.conf

追加新章節

<VirtualHost *:8090> 
    ServerAdmin [email protected] 
    DocumentRoot "/xampp/htdocs/site1" 
    ServerName site1.example.com 
    ErrorLog "logs/site1-error.log" 
    CustomLog "logs/site1-access.log" common 
</VirtualHost> 

<VirtualHost *:8091> 
    ServerAdmin [email protected] 
    DocumentRoot "/xampp/htdocs/site2" 
    ServerName site2.example.com 
    ErrorLog "logs/site2-error.log" 
    CustomLog "logs/site2-access.log" common 
</VirtualHost> 

重啓Apache

打開http://localhost:8090/http://localhost:8091/

相關問題