When I try to access locahost:8080, I get

The localhost page isn’t working

localhost didn’t send any data.

but if I try:, I get the response I'm looking for

I believe this has something to do with the httpd (apache) that I just updated with homebrew httpd24(httpd.2.4)?

I followed the instructions for updating from this site: https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions

  • 1
    does "ping localhost" resolve to ? You can check /etc/hosts as well.
    – Meiko Watu
    Dec 10 '16 at 17:33
  • Yes, ping localhost resolves to localhost broadcasthost
    – pixel 67
    Dec 10 '16 at 17:44
  • Did you have old config files which define a virtual host? Or is there anything in the apache log files? Do you see anything happening when you tail all log files and try to access localhost? "tail -f /usr/local/var/log/apache2/*"
    – Meiko Watu
    Dec 10 '16 at 17:44
  • I'm not sure, not really knowledgeable about the server configs, just fiddle until I get things working Here is a link the result when I run the tail call: gist file
    – pixel 67
    Dec 10 '16 at 17:48
  • 2
    localhost can also resolve to an IPv6 address while is guaranteed to be ipv4. Your application might behave differently ipv6 vs ipv4. Dec 10 '16 at 21:44

After installing httpd24 with brew you have two completely different Apache web server environments:

  1. brew's httpd24
  2. the original macOS/OS X httpd

Both have different config files and apachectl (and other) binaries. The first one is installed to /usr/local/Cellar/httpd24 and its binaries are linked to /usr/local/bin. macOS' httpd related binaries are located at /usr/sbin.

Depending on your PATH variable (enter echo $PATH to get it) sudo apachectl [cmd] either controls the first or the second Apache environment.

After installing brew the default PATH should be /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin which favors brew's httpd24. You can control macOS' Apache by using the full path (/usr/sbin/apachectl) though.

If you have a different path which doesn't favor /usr/local/bin over /usr/sbin it's the other way round. To get the path of the favored apachectl you can also simply enter which apachectl.

Check this with /usr/local/bin/apachectl -S which should yield:

VirtualHost configuration:
ServerRoot: "/usr/local/opt/httpd24"
Main DocumentRoot: "/usr/local/var/www/htdocs"
Main ErrorLog: "/usr/local/var/log/apache2/error_log"
Mutex default: dir="/usr/local/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
PidFile: "/usr/local/var/run/apache2/httpd.pid"
User: name="daemon" id=1 not_used
Group: name="daemon" id=1 not_used

and /usr/sbin/apachectl -S

VirtualHost configuration:
ServerRoot: "/usr"
Main DocumentRoot: "/Library/WebServer/Documents"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex default: dir="/private/var/run/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex proxy: using_defaults
PidFile: "/private/var/run/httpd.pid"
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used

There are no mutually used files/folders.

They also use different standard config files:

/usr/local/bin/apachectl -t -D DUMP_INCLUDES
Included configuration files:
  (*) /usr/local/etc/apache2/2.4/httpd.conf

The command doesn't work properly for the original (macOS) apachectl though and only yields: Syntax OK.

If you run both httpds (configuring different ports here: 80: macOS; 8080 httpd24 - check this in the respective config files) ps -aef | grep httpd | grep -v grep will show the following:

  0    76     1   0  4:54pm ??         0:00.13 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  1   219    76   0  4:54pm ??         0:00.00 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  1   220    76   0  4:54pm ??         0:00.00 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  1   221    76   0  4:54pm ??         0:00.00 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  1   222    76   0  4:54pm ??         0:00.00 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  1   223    76   0  4:54pm ??         0:00.00 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  1  4239    76   0  5:06pm ??         0:00.00 /usr/local/opt/httpd24/bin/httpd -D FOREGROUND
  0  8251     1   0  5:45pm ??         0:00.08 /usr/sbin/httpd -D FOREGROUND
 70  8261  8251   0  5:46pm ??         0:00.00 /usr/sbin/httpd -D FOREGROUND

The first seven pids belong to httpd24, the last two to macOS' httpd - check the binary paths listed! and nmap localhost:

Starting Nmap 7.31 ( https://nmap.org ) at 2016-12-22 18:00 CET
Nmap scan report for localhost (
Host is up (0.00039s latency).
Other addresses for localhost (not scanned): ::1 fe80::1
Not shown: 499 closed ports, 498 filtered ports
80/tcp   open  http
8080/tcp open  http-proxy

In your private chat message you can clearly see that httpd24 isn't running at all, but macOS' httpd is.

To disable macOS' httpd simply run sudo /usr/sbin/apachectl stop and additionally sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist (just to be sure).

Then dump the brew service start ... method by stopping the service and installing a real plist daemon like recommended in the linked how-to.

sudo cp -v /usr/local/Cellar/httpd24/2.4.23_2/homebrew.mxcl.httpd24.plist /Library/LaunchDaemons
sudo chown -v root:wheel /Library/LaunchDaemons/homebrew.mxcl.httpd24.plist
sudo chmod -v 644 /Library/LaunchDaemons/homebrew.mxcl.httpd24.plist
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.httpd24.plist

Reboot. If you still get an error connecting with localhost:8080 to your local developer site comment out fe80::1%lo0 localhost in /etc/hosts. In my environment it works with this line though.

After further investigations it turns out that a misconfigured web proxy (part of ESET's Internet Security/Antivirus) is the culprit. By adding a proper localhost exclude it should be possible to solve the problem.

  • Thanks for helping out, I tried your commands, here is the outputs of the commands in order that you wrote them.
    – pixel 67
    Dec 25 '16 at 10:45
  • I used the --privileged-port as well I'm almost ready to do a clean install
    – pixel 67
    Dec 25 '16 at 13:57
  • I don't have dnsmasq running, although I did play around with getting it setup awhile back. I did not perform mDBSResponder cache
    – pixel 67
    Dec 25 '16 at 14:09
  • @klonomath here is a gist of what's running
    – pixel 67
    Dec 25 '16 at 14:11
  • Let us continue this discussion in chat.
    – pixel 67
    Dec 25 '16 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.