VirtualHost不工作​​?

问题:

在我的本地机器上,我想inputURL homepage.local,我想打开我的本地网页index.html在我的本地目录/Users/prime/Homepage/ 。 我以为我可以通过使用下面的虚拟主机configuration来实现这一点,但似乎没有工作。

将以下内容添加到我的httpd.conf文件中

 <VirtualHost *:80> ServerName homepage.local ServerAlias *.homepage.local DocumentRoot "/Users/prime/Homepage/" </VirtualHost> 

当我去我的网页浏览器,并inputURL homepage.local它不解决我的网页/Users/prime/Homepage/index.html

有任何想法吗? 我在apache错误日志中看不到任何东西。

 $ apachectl -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 homepage.local (/private/etc/apache2/httpd.conf:533) 

我在OSX(雪豹)上。

你有没有设置你的主机文件? 除非networking正确地parsing到服务器,否则服务器名称伪指令什么也不做。

您可以按照以下说明编辑您的主机文件。 除了你想保持ip地址相同,只需将名称更改为homepage.local