A common annoyance with a standard Debian/Ubuntu install of Apache is that you’ll see these warnings on server restart:

mfogel@myhost:~$ sudo apache2ctl restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

And, if you google around for this you’ll see lots of advice telling you to specify a default ServerName directive. You can put this in /etc/apache2/httpd.conf, /etc/apache2/apache2.conf, or (hackishly, IMHO) in /etc/apache2/sites-enabled/.

The downside to this is that if you rename your sever, you then have to remember to alter your Apache config. Silly! Come on now.

Here’s a better way. Whatever the name of your server is…

mfogel@myhost:~$ hostname -f
myhost.mydomain.com

Then make sure this is the first entry for 127.0.0.1 in /etc/hosts.

mfogel@myhost:~$ cat /etc/hosts
127.0.0.1 myhost.mydomain.com myhost
127.0.0.1 localhost

With the myhost.mydomain.com being the first entry for 127.0.0.1, you’ll never see that warning again.