Mac OS X Lion Apache Server not Found

Posted by Burak Erdem on Super User See other posts from Super User or by Burak Erdem
Published on 2011-10-13T01:12:32Z Indexed on 2012/03/31 23:34 UTC
Read the original article Hit count: 307

Filed under:

After upgrading to Lion 10.7.2 today, Apache virtual hosts are not working anymore. When I go to http://XYZ.localhost, it say "server not found".

I am using Apache on my Mac OS X Lion and until today, it was working fine. I can access http://localhost but I can't access http://XYZ.localhost

My /etc/hosts file is like below;

127.0.0.1   XYZ.localhost

My /etc/apache2/extra/httpd-vhosts.conf file is like below;

<VirtualHost *:80>
    ServerName XYZ.localhost
    DocumentRoot /Library/WebServer/Documents/XYZ
    <Directory /Library/WebServer/Documents/XYZ>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

I think I once had this problem too, after another OS X update, but I can't remember how I solved it.

Is it a user permission issue? Or is there something wrong with Apache or any other setting?

EDIT: It seems like my /etc/hosts file is not working correctly. Even if I add something like 127.0.0.1 apple.com it still goes to the real apple.com. Maybe this might help to solve the problem.

© Super User or respective owner

Related posts about apache2