Php OSX Mavericks-使用子域设置Apache

Php OSX Mavericks-使用子域设置Apache,php,macos,apache,subdomain,Php,Macos,Apache,Subdomain,我已经成功地在我的Mac上设置了一个运行PHP的本地服务器,但是在设置额外的本地站点作为子域(即site2.localhost)时遇到了问题 以下是我目前掌握的情况: 主机文件: ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localho

我已经成功地在我的Mac上设置了一个运行PHP的本地服务器,但是在设置额外的本地站点作为子域(即site2.localhost)时遇到了问题

以下是我目前掌握的情况:

主机文件:

##
# 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>

我不确定我还需要添加什么或者需要添加到哪里。

好的,似乎我需要看起来更努力一点。。。事实上,它的设置是正确的,但由于某种原因,当我在浏览器中键入site2.localhost时,它默认为https

通过手动输入,它工作得很好

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