42

I am using OS X El Capitan with the Server (app) configured to allow me VPN access to my home network. Unfortunately, the Server app has decided to start a bunch of httpd processes, which are now listening on ports 80, 443 and others, even though the Server settings for Websites is OFF and no services should be started on these ports.

I do not want or need these services active and would like httpd to be shut down (or not start to begin with). Unfortunately, I can neither kill those processes (they just restart straight away) nor can I control them through launchctl.

sudo lsof -i :80
httpd   422 root    5u  IPv6 0x7...     0t0  TCP *:http (LISTEN)
httpd   425 _www    5u  IPv6 0x7...     0t0  TCP *:http (LISTEN)

ps u 422
USER   PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
root   422   0.0  0.0  2457156   6136   ??  Ss    5:55PM   0:00.07 /usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf -E /private/var/log

When trying:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service

So, how do I terminate those processes and free up those ports?

I know there is a config file for the apache server here: /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf

I can remove the following lines to unblock those ports, but the httpd processes are still running.

listen 80
listen 443
0

4 Answers 4

26

The apple proxy service is the service that grabs ports 80 and 443, so you need to stop that one.

sudo launchctl unload -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
1
  • 3
    This turned out to be exactly the solution for me. "sudo apachectl stop" just gave the same error as launchctl.
    – Kosmonaut
    Sep 12, 2016 at 19:26
43

You can stop that with command:

sudo apachectl stop
1
  • 3
    Tested and works on macOS Catalina 10.15.3 Apr 10, 2020 at 20:29
11

This command should kill them all:

sudo killall httpd

They will start again on next boot.

2
  • 4
    I didn't downvote either, but it may have to do with the fact that I mentioned that there is no point in killing the processes, since they are being restarted automatically.
    – Chris
    May 25, 2016 at 4:28
  • surprisingly, after trying every other method... this one worked... for some reason the daemon stayed alive after being unloaded and killed every other way, this one cleaned it up
    – Ray Foss
    Dec 31, 2018 at 15:43
7

In case others are reaching this question by searching for httpd or port 80 but don't have the Server.app running, this is the solution for macOS Monterey 12.x and later:

sudo launchctl bootout system/org.apache.httpd
3
  • That was it. Thanks. It was painful. Jul 14, 2022 at 12:04
  • 1
    This worked on Ventura 13.3.1
    – fmitchell
    May 9, 2023 at 13:28
  • This is working on Ventura 13.3.1 May 16, 2023 at 0:50

You must log in to answer this question.

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