我跟着本文, 与一些混合其他 研究,努力VirtualHost
在我的 Mac 上进行配置并运行。然而,由于某种原因,当我导航到我的local.site.rocks
URL 时,它最终会通过我的 ISP 进行搜索(很奇怪)。
这是我的httpd-vshosts.conf
文件:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName site.rocks
ServerAlias local.site.rocks
ErrorLog "/private/var/log/apache2/site.rocks-error_log"
CustomLog "/private/var/log/apache2/site.rocks-access_log" common
<Directory "/var/www/site.rocks/public_html/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
这是我的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
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 local.site.rocks
我还确保取消了Include
该文件的注释。此外,在尝试导航到 URL 之前,vshosts
我确实发出了。apachectl restart
我在这里错过了什么?它必须是简单的事情。