Could not determine the server's fully qualified domain name, using 127.0.0.1

chris (2006-05-06 20:55:44)
7607 views
0 replies
When restarting Apache, this error can sometimes occur: "Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName". It happened today when I restarted Apache having just added a new virtualhost to my Apache config. I decided to look in my Apache error log for some clues:
[Sat May  6 20:39:54 2006] [alert] mod_unique_id: unable to gethostbyname("nikita")
[Sat May  6 20:40:14 2006] [alert] mod_unique_id: unable to gethostbyname("nikita")
[Sat May  6 20:42:26 2006] [alert] mod_unique_id: unable to gethostbyname("nikita")
[Sat May  6 20:43:56 2006] [alert] mod_unique_id: unable to gethostbyname("nikita")

Well there are the clues.. Nikita is the name of this host. I decided to grep for 'nikita' in the Apache config to see where it occurs:
root@nikita:~# grep nikita /etc/apache/httpd.conf
root@nikita:~#

So it's nothing to do with the httpd.conf. Let's look at that error again: "Could not determine the server's fully qualified domain name". That means that it's unable to construct a full FQDN for nikita (which would be in the form nikita.spiration.co.uk). This points the finger at the DNS, so I decided to check my resolv.conf:
root@nikita:~# cat /etc/resolv.conf
nameserver 195.82.96.40
nameserver 195.82.96.6

So there's a clue - there's nothing to indicate where we are. I mean what would the domain of 'nikita' be? There's only one line required here to tell the DNS to check a parent domain - here's the corrected resolv.conf:
root@nikita:~# cat /etc/resolv.conf
search spiration.co.uk
nameserver 195.82.96.40
nameserver 195.82.96.6

That's all it took - restart apache now with apachectl restart and everything is fine.

christo
comment