Change Apache DocumentRoot on Mac

by Michael Scepaniak on November 22, 2008 in software development

I was trying to configure Apache on my Mac to better incorporate it into my desktop development environment. Part of that included customizing the DocumentRoot location – changing it from the default directory (/Library/WebServer/Documents) and pointing (or linking) it to a directory that just made more sense to me. But it wasn’t as easy as I expected.

Trouble was, I couldn’t get Apache to reflect my changes to the Apache configuration file (httpd.conf), regardless of how many times I restarted Apache (via System Preferences). Finally I did a find (find /etc/ -name "httpd.conf") and figured out that I was editing the wrong configuration file (/etc/httpd/httpd.conf). My Mac was actually running Apache v2, but I was editing the configuration file for the now defunct (but apparently still present) Apache v1 installation. So I edited the correct configuration file (/etc/apache2/httpd.conf), restarted Apache as before, and everything worked as expected. 🙂

Want to be notified when new articles are posted?
Enter your email address:

{ 2 comments… read them below or add one }

Jonathan Julian August 26, 2010 at 7:21 pm

I like to download and build my own apache, then build up my own small conf file. Then to (re)start it, I use `sudo httpd -f ~/apache/httpd.conf -k graceful`. One day I’ll take some time to build a launchd script to bring it up at boot.


Michael Scepaniak August 26, 2010 at 7:29 pm

I didn’t realize Apache still got much use amongst Ruby folks.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed

Previous post:

Next post:

Member of The Internet Defense League