I have spent the better part of an hour and a half trying to figure out how to get virtual hosting working under Lion's native Apache server. On my laptop, running 10.6, I was able to get virtual hosting by uncommenting this line in httpd.conf:
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
and then adding the appropriate block in the httpd-vhosts.conf
file, along with adding an entry in /etc/hosts
like so:
127.0.0.1 foobar.local
This does not work with 10.7 for some reason. When going to http://localhost/
everything works fine, but when I try to hit foobar.local
it just keeps spinning away and never loads anything. Running httpd -S
from the command line shows the correct vhost configuration but that doesn't seem to matter.
The approach in this article on setting up a native MAMP stack didn't work for me either. And despite the report by some that the problem is because of IfDefine WEBSHARING_ON
, for me it didn't matter where I put the Include
directive.
Has anyone else had this problem? And perhaps more importantly, has anyone found a resolution?