I've been using an Ubuntu distro for a few years now and I greatly prefer the default Apache2 settings on Ubuntu compared to OS X. This post aims to provide instructions on how to convert the few settings I want from 'mac-style' to 'ubuntu-style'.
I'm trying to change the default behaviour of Apache on OS X to be similar to Ubuntu, including both the apache user / group and work directory. The information I have found so far on this points to the following:
- Apache on Ubuntu runs under www-data, on Mac under _www
- Apache on Ubuntu uses /var/www, on Mac /Library/Webserver/Documents
I got this information on Mac from /etc/apache2/httpd.conf.
Do I need to delete the _www user / group, before making the new www-data user and group, or can I simply change the former? How do I do the correct one without breaking everything?
I believe I can simply change the line in httpd.conf to change the root directory for files, and create the /var/www/ folder also. But in order to do this in the right way, I'll need the right permissions, so (1) needs to be done first.
The end goal:
To have a
www-data user running Apache (like Ubuntu has) rather than
_www, and also have my root directory under
/var/www (like Ubuntu has) rather than
/Library/Webserver/Documents, and for any PHP extensions via PECL or otherwise not to be affected by this change.
How can I set this up correctly so that "it just works", and won't interfere with anything like extensions / other modifications in the future?
I'm running OS X 10.9.4, Apache/2.2.26.