I have an issue where Apache will not start on a restart. I have tried commands like
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
to allow Apache to start, but it hangs up and I am unable to reach the site. I get the message
(48)address already in use ah00072 Unable to open logs.
which tells me that port 80 is in use. When I look at the active processes listening to port 80 I find that it is apache (httpd) is the only process running on 80. So I run
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
to remove apache from the 'automatically' launching at startup, and I am able to run apachectl start
without an issue.
The mac is running 10.12.5 Sierra.
Best Answer
I've had good luck using the homebrew builds to start and stop daemons as they handle the launch preferences well with simply syntax.
A side benefit of having this version is you can patch and upgrade faster than Apple does. The downside is you might need to move your configuration files from the system side to the /usr/local/bin side one time.
If you are running a headless mini - I also am a big fan of using Server.app to make the web service a couple of clicks easy and the server.app also helps with certificate management, gives you Apple Push Notifications and several other useful bundled services.