Apache2 Won't Start on Startup

Ryan Schmidt ryandesign at macports.org
Thu Feb 4 13:23:07 PST 2010

On Feb 4, 2010, at 14:57, Rob Wilkerson wrote:

> Include "${HOME}/Dropbox/Application Support/apache/conf.d.osx/*.conf"
> Include "${HOME}/Library/Application Support/MacPorts/apache/conf.d/*.conf"
> Unfortunately, my username on each Mac is different (one is a work
> machine that I can't change) which is why I'm using the ${HOME}
> environment variable to tell Apache where to find the conf files. As
> far as I can tell, that's the root of this problem. Even though the
> LaunchDaemon is loaded, Apache won't start when I boot up. The system
> log reports that:
> Feb  4 07:05:01 robwilkerson org.macports.apache2[55]: httpd: Syntax
> error on line 512 of /opt/local/apache2/conf/httpd.conf: Include
> directory '/opt/local/apache2/${HOME}/Dropbox/Application
> Support/apache/conf.d.osx' not found

Apache doesn't know which user's home directory you'd like it to use. Apache starts as root, then switches to the _www user; it has no idea what user you're currently logged in and using the computer as. I'm not sure of a way that it could automatically determine that either, and I also don't know of a way to use variables in the path of an Apache Include statement.

You may have to settle for this:

Include "/Users/*/Dropbox/Application Support/apache/conf.d.osx/*.conf"
Include "/Users/*/Library/Application Support/MacPorts/apache/conf.d/*.conf"

This would include conf files in *every* user's home directory in that location. But if you're the only person using these computers (the only user account on these computers, or the only user which has conf files in that location) then it shouldn't be a problem.

More information about the macports-users mailing list