If you are like me by using the OS X Server to host diffent things as your calendar and contacts in replacement of iCloud maybe you meet the same problem as me.

OS X Server just block the port 80.

It is a problem when you want to host something on this port as Web site, blog or whatever else you want without using the include Apache server of the OS X Server.

Unfortunately, turning off the OS X Server's WEB service is not enough and can be tricky.

Turn off the WEB service in OS X Server and try to connect from a Web browser. You may get a reply saying: WEB service is off.
Great to have this message! But of course, in order for the server to respond with the WEB service is off message, the Web server has to be on!
Then OS X Server still ends up blocking the port 80.
If you want to be sure that I am not a liar, you can run this command in the terminal to see which process use the 80 port.

sudo lsof -i :80  

Disabling Apache

A way to disable the WEB Service on OS X Server is to remove the Launchd task of the server manually. And even if I searched through the WEB I didn't find something else more elegant.

Unload the launchd task

Open a terminal and enter this command to tell the system to turn off the Apache service.

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

Now we need to remove the deamon startup file from launchd to be sure that the system will not start Apache again at the next reboot.
To do that just move the file org.apache.httpd.plist somewhere else.

Finally restart your server to be sure that Apache does not restart at the boot time.

Now we can check if our port 80 is free by opening a terminal and using this command:

sudo lsof -i :80  

This command should return nothing if the port is free.

Great but I am still not able to launch any service on the port 80 !!! What the hell is still going wrong?

Do not be afraid, the problem is easy.
In OS X the user has not the privilege to run applications which use the ports from 1 to 1023. Only an administrator account does. Then run the application from an administrator account or with administrator permission. That's it!

I tested and use this trick on OS X Mavericks Server then there is not warranty that is work with another OS X Server version.

© 2017 Gulivert's Blog