0

I've got a Mac mini 2014 (running macOS Sierra 10.12.2) with the Server.app installed.

I was planning on hosting a webserver on this device on the default http(s) ports. However, I've found that one of the services installed by the Server app has already bound these ports.

I've tried to disable the service that's binding these ports by using launchctl and stopping anything that vaguely looks like apache/httpd. Unfortunately, this wasn't enough.

Does anyone know which service is binding these ports?

1

Comment out listening ports at the beginning of the file /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf

Kill parent httpd process which contains substring "/usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf". For listing these running proceses use ps -fax | grep apache_serviceproxy.conf, for example.

0

To check the ports enter:

sudo lsof -i :80
sudo lsof -i :443

The commands will yield something like this:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd     316 root    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)
httpd     378 _www    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)
httpd     379 _www    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)
httpd     380 _www    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)
httpd     381 _www    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)
httpd     382 _www    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)
httpd   59259 _www    5u  IPv6 0xec3d90f272a0383d      0t0  TCP *:http (LISTEN)

and

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd     316 root    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)
httpd     378 _www    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)
httpd     379 _www    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)
httpd     380 _www    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)
httpd     381 _www    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)
httpd     382 _www    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)
httpd   59259 _www    7u  IPv6 0xec3d90f272a01d5d      0t0  TCP *:https (LISTEN)

Now check one or all of the pids with e.g.:

ps u 59259

with the result:

_www 59259   0,0  0,1  2448556   2360   ??  S     4:00pm   0:00.01 /usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/Proxy

Obviously it's related with apache/httpd but the webserver isn't loaded. So check /Library/Server/Web/Config/Proxy. The relevant file here is /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf. Comment out or modify the annoying listening ports at the beginning of the file. Reboot. This will break some OS X Server.app functionality.

Alternatively you may simply uncheck Enable PHP and Enable Python in the Server.app > Websites (even if Websites are Off!). There is a delay of up to 31 seconds until the new settings become operative.

  • There is indeed a service proxy running currently. When I'm home, I'll see whether disabling the PHP server in Server.app works. Thanks thusfar! – irundaia Jan 11 '17 at 15:43
  • I've disabled both "Enable PHP" and "Enable Python". The service is still started though (and opens the mentioned ports). What features of the Server.app would removing the listen commands break? – irundaia Jan 11 '17 at 19:17
  • @irundaia I have tested the disable PHP/Python solution several times and it worked. I didn't reboot though - just a moment I have to recheck this. Commenting out the two ports 80/443 in apache_serviceproxy.conf will disable some website related features (but probably no other services like OpenDirectory DNS or DHCP). I haven't tested this thoroughly - it was just an assumption. – klanomath Jan 11 '17 at 19:23
  • @irundaia Even after a reboot the disable PHP/Python works for me. No open ports neither with nmap nor lsof. Starting a webserver with sudo python -m SimpleHTTPServer 80 also works without errors. You have to wait up to 31 seconds after disabling php/python until the services are shut down! – klanomath Jan 11 '17 at 19:36
0

this was helpful for me:

launchctl unload -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist

You must log in to answer this question.

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