Apache2 Won't Start on Startup
ryandesign at macports.org
Sat Feb 6 03:36:13 PST 2010
On Feb 5, 2010, at 04:36, Rob Wilkerson wrote:
> On Thu, Feb 4, 2010 at 4:23 PM, Ryan Schmidt wrote:
>> 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.
> That makes sense. It seems to be fine when I manually start Apache
> using 'sudo apachectl start', so I guessed that it was something
> specific to the boot process.
Ahh... When you "sudo apachectl start", presumably it inherits some environment variables from your shell, including the HOME variable. But at startup time, your shell does not exist.
>> 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.
> Unfortunately, that doesn't seem to work:
> httpd: Syntax error on line 512 of /opt/local/apache2/conf/httpd.conf:
> Wildcard patterns not allowed in Include /Users/*/Dropbox/Application
Hmm. Then I guess you'll have to go with the other suggestion of setting an environment variable in the envvars script. Be sure to keep a copy of this script and be aware that at present, any time you upgrade the apache2 port this file will be overwritten. I have already filed a bug report about that.
More information about the macports-users