Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Having compiled, installed and configured Apache 2.2.15 on Mac OS X Server 10.6, all went fine. The server is running fine when started manually, no configuration problems.

Then i added a launchd system wide daemon (in /Library/LaunchDaemons/), loaded it and rebooted. Again this seems to work fine.

But Apache doesn't start at boot due to a problem with mod_unique_id, i guess. Here is the apache error log entry:

[Tue Jun 29 09:01:29 2010] [alert] (EAI 8)nodename nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "my.server.net" Configuration Failed

It seems to me that launchd is firing the job too early in the boot process, at a time when reverse DNS lookup isn't done or properly propagated. If i start Apache manually via ssh, it starts without errors. (The server has a static IP with a fully qualified domain name set.)

Here is some lines out of my system.log:

Jun 29 09:01:29 org.apache.httpd[88]: httpd: apr_sockaddr_info_get() failed for my.server.com
Jun 29 09:01:29 org.apache.httpd[88]: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Jun 29 09:01:29 emond[78]: SetUpLogs: uid = 0 gid = 0
Jun 29 09:01:29 emond[78]: SetUpLogs: opening /Library/Logs/EventMonitor/EventMonitor.error.log
Jun 29 09:01:29 sandboxd[100]: kadmind(54) deny network-bind 0.0.0.0:654
Jun 29 09:01:29 sandboxd[100]: kadmind(54) deny network-bind 0.0.0.0:0
Jun 29 09:01:30 loginwindow: Login Window Application Started
Jun 29 09:01:30 com.apple.launchd (org.apache.httpd): Exited with exit code: 1
Jun 29 09:01:30 configd: network configuration changed.

The logs here are pretty clear, Apache is launched and fail to start right before the network is configured with a valid IP and DNS name. But this isn't consistent, in an other boot, the network configuration is done first, but the problem persists.

I tried to set the ServerName variable in httpd.conf to either the server's IP or FQDN, didn't helped.

I am a little lost, that's why i came here. Many searches on the net didn't helped me either.

What am I missing?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can tell launchd to respawn the daemon if it crashes by adding something like this:

<key>KeepAlive</key>
<true/>

to the launchd .plist file. Note: make sure you're running httpd with the -D FOREGROUND option so launchd can track its state properly, i.e. you should be running it like this:

<key>ProgramArguments</key>
<array>
    <string>/path/to/httpd</string>
    <string>-D</string>
    <string>FOREGROUND</string>
</array>

Also, you might want to change the item's label (and filename) to something other than org.apache.httpd; there's already a daemon by that label in /System/Library/LaunchDaemons, and I'm not sure if there's a possibility of a label conflict.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.