Skip to content

Instantly share code, notes, and snippets.

@auxcoder
Forked from chrisroos/README.md
Created March 20, 2016 23:38
Show Gist options
  • Save auxcoder/0d67ec093cac4756fe5b to your computer and use it in GitHub Desktop.
Save auxcoder/0d67ec093cac4756fe5b to your computer and use it in GitHub Desktop.
Apache 2.4 on OS X Yosemite listening on ::1 and not 127.0.0.1

Apache appears to be listening on ::1 but not 127.0.0.1.

$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.

$ telnet 127.0.0.1 80
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

This caused me quite a few problems when trying to create new virtual hosts. I installed dnsmasq and added a wildcard to respond to *.dev. I configured this using address=/dev/127.0.0.1 and then spent ages trying to understand why I couldn't connect to my 'server-name.dev' virtual host. I finally realised that Apache wasn't listening to 127.0.0.1 and changed the dnsmasq config to use the ::1 IPv6 loopback address (address=/dev/::1). This fixed my problem and my virtual host now responds correctly.

I'm now fairly sure this was caused by Pow. Although I'd unloaded the service (launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist) the Pow firewall was still in place. Disabling the firewall (sudo pfctl -d) allows me to telnet to 127.0.0.1 on port 80.

I've now uninstalled Pow entirely and Apache correctly starts on boot, listening on both 127.0.0.1 and ::1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment