problem accessing localhost on Mac OS X Mavericks...it was working fine until I rebooted today

Had the same problem. I deleted one of my project's folder and it became broken. In this case the site's configs should be removed from httpd-vhosts.conf and httpd.conf.

Try ping 127.0.0.1

apachectl configtest can help you to detect the problem.


The problem could be that the hosts file might have been corrupted from the original ASCII encoding. I cleared all spaces and put tabs in it, ran sudo killall -HUP mDNSResponder (you can do that instead of rebooting) and after, it worked.


Refused connections are most commonly caused by a server that is not listening to the port.

Syntax errors or general config file errors will kill apache at startup (usually without reporting to error logs or terminal).

Try running sudo apachectl configtest and see if it outputs any error messages.


In my case, the issue was that the folder /private/var/log/apache2/ was gone missing for unknown reasons. Recreating it with

sudo mkdir /private/var/log/apache2

and restarting apache with

sudo apachectl restart

made the trick!