how to help Apache determine the server's fully qualified domain name

From Sharkysoft Wiki
Jump to: navigation, search

Tell me you haven't seen this before. After setting up a brand new Apache web server, you see the annoying error message:

apache2: Could not reliably determine the server's fully qualified domain name, using (some domain name) for ServerName

Fortunately, this problem is pretty easy to fix. I'm no Apache expert, but it appears that when Apache boots, it reads your /etc/hosts file to determine your server's fully qualified domain name. All you have to do is make sure that the first entry Apache sees for 127.0.0.1 is your fully qualified domain name, like so:

127.0.0.1 subdomain.sharkysoft.com

Grab your favorite text editor, make the change, and then test your work by restarting Apache with the following command:

service apache2 restart

If Apache restarts without that annoying error message, hold your head high and know that you just showed Apache who's boss.

Oh, and don't forget to actually use your browser to ensure your web site is still working correctly, especially if you are running multiple virtual hosts. Check them all!

Personal tools
Namespaces

Variants
Actions
Navigation
Tools