miracle occurs here|

Change Apache DocumentRoot on Mac

November 22nd, 2008 at 3:14 pm by Michael Scepaniak

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. :)

If you enjoyed this post, you might want to follow this blog!

2 Comments

trackback
  1. Jonathan Julian Says:

    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.

  2. Michael Scepaniak Says:

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

 Follow comments for this post

Leave a Comment