Changing OS X's Apache settings to replicate Ubuntu's Apache environment 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.

My questions:


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.
You can always do a clean install, from source, of Apache HTTPD, with whatever settings appeal to you. If you want it to walk, talk, and quack like Ubuntu, choose pathnames, user-ids, and everything else to match as part of the 'configure' process. All you need to do to your stock Apple deployment is turn it off to avoid avoid port conflicts.

You could try to reconfigure the Apple default install to be more Ubuntu-ish, but you risk getting tripped up by some obscure decision made by Apple, up to and including source mods. So I suggest that your best best is to use the source, as its authors intend.