2013-11-26 37 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它工作正常。