Connection Refused for Apache 2.4 Virtual Host [duplicate]

Check you httpd.conf to see if you have the following:

Listen 127.0.0.1:80

You have to replace it with:

Listen *:80

By doing this, Apache will bind to all of the computer's interfaces, not just the loopback interface.

Don't forget to restart Apache after editing httpd.conf.


Even though Apache was listening to port 80, this port was refusing connection. In the end this is what worked for me:

I made sure port 80 was open for TCP on all interfaces, which on OSX you do by adding

pass in proto tcp from any to any port 80

to /etc/pf.conf. Reloading pfctl didn't quite do the trick, but a reboot did. Now all my virtual hosts are accessible. And the world is in order again.


Try to connect test.dev with another available port fot http or https communication. OR stop the previous PID with port ':80' and then run. Check the process ID with -

netstat -ltnp | grep ':80'

kill -9