Lion上的VirtualHost导航到错误的文档根目录

我正在努力获得我的本地狮子开发机器上运行的虚拟主机

这是场景。 我有Site-A.dev和Site-B.dev坐在我的User/computername/Sites文件夹,如下所示: User/computername/Sites/Site-A.com User/computername/Sites/Site-B.com

我的/etc/apache2/extra/httpd-vhosts.conf文件包含以下条目:

 #<VirtualHost *:80> # DocumentRoot /Users/computername/Sites/Site-A.com # ServerName project.Site-A.dev #</VirtualHost> <VirtualHost *:80> DocumentRoot /Users/computername/Sites/Site-B.com ServerName project.Site-B.dev </VirtualHost> 

而我的etc/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 fe80::1%lo0 localhost #127.0.0.1 project.Site-A.dev 127.0.0.1 project.Site-B.dev 

尽pipeSite-A的所有实例都被注释掉了,但是每次我尝试http://project.Site-B.dev ,都会在浏览器中得到Site-A! 世界正在发生什么?

为了使事情更混乱,编辑我的/etc/apache2/httpd.conf文件看起来像这样:

 # Virtual hosts Include /private/etc/apache2/extra/httpd-vhosts.conf 

我得到一个服务器未find错误!

如果我离开它像:

 # Virtual hosts #Include /private/etc/apache2/extra/httpd-vhosts.conf 

然后我得到的是网站-A

我错过了什么?

编辑应该指出的是,这两个网站都运行PHP

运行httpd -S我发现我的httpd-vhosts.conf文件的位置已经移动到/private/etc/apache2/other/httpd-vhosts.conf

下面是httpd -S报导的:

 [Tue Feb 07 12:51:37 2012] [warn] module php5_module is already loaded, skipping httpd: Could not reliably determine the server's fully qualified domain name, using macshortname.local for ServerName VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server Site-A.com (/private/etc/apache2/other/httpd-vhosts.conf:17) port 80 namevhost Site-A.com (/private/etc/apache2/other/httpd-vhosts.conf:17) port 80 namevhost localhost (/private/etc/apache2/other/httpd-vhosts.conf:36) Syntax OK 

一旦我发现我正在编辑错误的httpd-vhosts.conf文件,我能够解决这个问题。