1

I installed httpd using brew.

I edited /usr/local/etc/httpd/httpd.conf and changed:

Listen 8080

to:

Listen 80

Restarted the service:

brew services restart httpd

But Apache's still listening on port 8080:

Benjamins-Mac-mini:~ benjamin$ sudo lsof -iTCP:80 -sTCP:LISTEN
Benjamins-Mac-mini:~ benjamin$ sudo lsof -iTCP:8080 -sTCP:LISTEN
COMMAND   PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd   24646 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   24647 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   24648 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   24649 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   24650 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   24651 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   34288 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   34289 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)
httpd   34290 benjamin    4u  IPv6 0xcc42d5b2e5fcae09      0t0  TCP *:http-alt (LISTEN)

How can I force httpd to listen to port 80?

I tried restarting the service using sudo as port 80 is a privileged port, with no success.

1

I figured it out.

I had started another instance of httpd by mistake earlier. I typed:

httpd --help

And while httpd doesn't recognize this command (what I was looking for was httpd -h), it did start a daemon, that was listening according to the old config file.

I'm very surprised that brew services start thought it was starting the server properly (brew services list did display it as started), even though it probably wasn't running because of the conflicting instance.

This is really confusing as start/stop did toggle between "started" and "stopped", even though it probably wasn't doing anything under the hood.

0

You probably have a directive like this with 8080:

<VirtualHost *:8080>
 ServerName xyz.com
 etc…
 </VirtualHost>

You need to change that to

<VirtualHost *:80> 

Make sure that you have correctly configured your directives for each subdomain you may have, including the default one (if it's been configured manually to listen to :8080 right after the name).

  • This didn't help I'm afraid, abd I checked for every single instance of 8080 in httpd's config dir, none left. – Benjamin Sep 13 at 15:07
  • Then your system might be using 80. If should be launchd, I suggest you look at this if you haven't done it yet: superuser.com/questions/597398/… – Udhy Sep 13 at 15:43
  • The problem was not port 80 being in use, but another httpd process already running, see my answer. The real issue is brew services acting as if there wasn't a problem in this case! – Benjamin Sep 13 at 15:47
  • Good, you managed. – Udhy Sep 13 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .