2013-11-26 33 views
2

我已經成功地建立了我的Mac上運行PHP的本地服務器,但我無法設置額外的本地網站的子域名(即site2.localhost)OSX小牛 - 設置Apache使用子

這裏是我的到目前爲止有:

hosts文件:

## 
# Host Database 
# 
# localhost is used to configure the loopback interface 
# when the system is booting. Do not change this entry. 
## 
127.0.0.1  localhost 
127.0.0.1  site2.localhost 
255.255.255.255 broadcasthost 
::1    localhost 
fe80::1%lo0  localhost 

的httpd-vhosts.conf:

NameVirtualHost *:80 

<VirtualHost *:80> 
    DocumentRoot "/Users/user/Sites/site2" 
    ServerName site2.localhost 
</VirtualHost> 

,我已經註釋掉httpd.conf文件以下行:

Include /private/etc/apache2/extra/httpd-vhosts.conf 

我不知道我需要什麼其他補充或者我需要添加它。

回答

2

好的,好像我需要看起來有點難......它實際上設置正確,但由於某種原因,當我在瀏覽器中鍵入site2.localhost時,它默認爲https。

通過手動輸入http://site2.localhost它工作正常。