Archive for the ‘Tips’ Category

Apache2 on Ubuntu issue

Tuesday, August 26th, 2008

At home I run all my development on a server which is running Ubuntu 8.04 (Hardy Heron). I’ve been somewhat annoyed at a reoccurring warning message that I receive every single time I restart apache2 from the command line:


sudo /etc/init.d/apache2 restart
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
...done.

This wasn’t preventing Apache from running or my sites from displaying, but like I said, it was annoying, so I fixed it. If you’re having the same problem and want to fix it for yourself, these are the simple steps I took:

Make a backup of apache2.conf in your home directory:


sudo cp /etc/apache2/apache2.conf ~/apache2.conf.backup

Open up apache2.conf (use your favorite text editor, I used vim):


sudo vim /etc/apache2/apache2.conf

Add the following line at the top:


ServerName localhost:80

Restart apache:


sudo /etc/init.d/apache2 restart

That should do it. When you restart Apache you shouldn’t see the message.

If this fails and Apache won’t start for you after applying this fix, it means you did something wrong. You can revert your file with the backup you made:


sudo cp ~/apache2.conf.backup /etc/apache2/apache2.conf

Yes this is basic, but hopefully it will spare someone time and a headache. Also, a quick note: any time I run in to a small issue (such as this one) or larger issues (such as anything related to mythtv) I will be posting it here.