Posts

Why is apachectl not working on OS X Server 5.x?

With OS X Server 5 has introduced quite a few changes.

Once you install OS X Server 5 on Yosemite or El Capitan, the “desktop” version of Apache is taken over by a “server” version inside Server.app. To differentiate between the two and to take into account the different methods for stopping and starting Apache, a new command has been introduced with server-apachectl.

You can still use the same parameters. For example:

sudo server-apachectl graceful

sudo server-apachectl restart

Why do the web server logs show all connections as coming from 127.0.0.1?

If you looked at your web server logs after upgrading to OS X Server 5, you might have noticed that all connections seem to come from your localhost at 127.0.0.1 instead of the actual IP of the connecting user.

This is due to how OS X Server 5 implements virtual websites. Instead of exposing the sites directly, they are funnelled through a proxy (whether this is a good or a bad choice depends on your point of view).

To see the actual IPs of incoming connections to your web sites, either look at ‘/private/var/log/apache2/service_proxy_access.log’ or set up custom logging using ‘%a’ (don’t use ‘%h’ as it will resolve to the localhost).