我已经在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>
我在httpd.conf文件中取消注释了以下行:
Include /private/etc/apache2/extra/httpd-vhosts.conf
我不确定我还需要添加什么,或者我需要添加它。
答案 0 :(得分:2)
通过手动输入http://site2.localhost,它可以正常工作。