localhost not working on OS X Yosemite

Check your Apache config with this command:

sudo apachectl -t

This tests the config files and tells you if there's an error. Running sudo apachectl start does not output config file syntax errors to the logs for some reason.


This command should tell you what on which port and which IPv(4/6) address your Apache is listening :

sudo lsof -P -n -iTCP -sTCP:LISTEN | grep httpd

If there is nothing listening, what do you get from this ?

sudo serveradmin status web
sudo serveradmin settings web
ps -acx | grep http

.

At last resort :

sudo serveradmin stop web

Open Console.app and place a bookmark

sudo serveradmin start web

Check the logs