Today I was trying to install a program on my OS X Server and the software complained that something was listening on port 8080. I couldn’t figure it out, so after a bit of searching I found a command that could get me closer:
sudo lsof -iTCP -sTCP:LISTEN -P -n | grep 8080
The output had in it:
httpd 21950 _www 7u IPv6 0xc086bca85e9b29f7 0t0 TCP *:8080 (LISTEN)
httpd 65328 _www 7u IPv6 0xc086bca85e9b29f7 0t0 TCP *:8080 (LISTEN)
OK, so now I know that the _www user was running the process. Next up was to do:
ps awuwx | grep _www
Which gave me:
_www 23128 0.0 0.0 2518828 1132 ?? S 8:41PM 0:00.00 /usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/apache2/httpd_server_app.conf
Ah, this tells me that OS X’s Server App is running Apache which is fine, but I had Websites turned off in OS X Server!
Hmmm, how do I disable Apache without hacking away on the http files? Well, I noticed on the Websites section I had an entry listening on port 8080. I removed the entry and presto, my server stopped listening on port 8080. Very odd because Websites is off, but OS X Server decided that if Websites is off, it should still listen and serve up a page that says “Websites are turned off.”
Besides Apple ending the text with a preposition, this is absolutely the wrong behavior in my opinion. I understand that certain services (CalDAV, WebDAV, etc.) run through Apache and OS X Server has to have it on to work, but Apple needs to have better messaging to indicate that it is listening on various ports and how to turn off the websites.
Maybe I’m not the average OS X Server user in that I run various other services including Jenkins, but OS X Server still is not up to snuff; I’m not sure why I keep running it. OK, I do know why I keep running it; the caching server is excellent, VPN service is good, and file sharing is pretty easy to setup. Good thing I’m not afraid of the command line and can figure this out.