I have my Mac's local apache server running and when I visit localhost I get the standard "It Works" page. The "It works" page was cached - it is in fact broken the same as 127.0.0.1. When I visit 127.0.0.1 however chrome gives me Error code: ERR_CONNECTION_REFUSED
. So I ran a telnet
. Result:
harryg$ telnet localhost 80
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
telnet: Unable to connect to remote host
But scutil
gives this:
harryg$ scutil -r localhost
Reachable,Local Address,Directly Reachable Address
Any idea why it isn't working? Is apache listening on some different port? If so how do I check? I have some local vhosts which should be accessible by some local .dev
virtual hosts that I've added to my hosts file. E.g. 127.0.0.1 home.dev
but they too give the error above.
Edit
It seems nothing is listening on port 80. When I run sudo lsof -iTCP:80 -sTCP:LISTEN
I get no output. Apache seems to be running though - I have run apachectl
restart` many times.
localhost
is working perfectly fine. Apache isn’t. Update your question to represent this fact and don’t forget to include the relevant bits of your Apache config and its log files.