Wednesday, October 6, 2010

Apache 2 Error "apr_sockaddr_info_get() failed"

I'm setting up a couple of Red Hat Enterprise Linux boxes (that will likely replace some Windows 2008 servers, which of course makes me exceptionally happy), and I ran into the following error when I started Apache:

Starting httpd: httpd: apr_sockaddr_info_get() failed for host.name.here
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName



The second part of that error is pretty common (and nothing to worry about most of the time), but I hadn't seen that first error message before.

A bit of scroogling and experimenting led to the solution quickly enough so this is another one of those "so I don't forget" blog posts more than anything, but hopefully it'll help someone else who runs into this.
In my case the server's host name didn't have a corresponding DNS entry yet, so to resolve the error I simply added the server's host name to /etc/hosts and pointed it to 127.0.0.1.

Of course depending on your situation you may want a DNS entry too, but I tend to have all the host names for the server itself in the hosts file on the server so it doesn't have to do a DNS lookup only to find itself. Particularly when you're behind a load balancer things get weird if you don't leverage your hosts file.

No comments: