If you are using Apache on Ubuntu, then you most likely ran into the annoying warning about determining the fully qualified domain name of your server. Something like this will show up in your logs, on start of the server or on log rotation:
apache2: Could not reliably determine the server's fully qualified domain name, using 10.10.0.40 for ServerName
Luckily there is an easy fix it. All you have to do is adding the ServerName directive to your Apache configuration and specify a good server name. Usually localhost will do fine, unless you are using the machine without virtual hosts, just as a base server.
A quick and dirty way would be adding the following line to /etc/apache2/httpd.conf or to /etc/apache2/apache2.conf and restart your Apache service.
ServerName localhost
And then restart your Apache service with the following command:
/etc/init.d/apache2 restart
Or on newer systems with:
service apache2 restart
Now, if you have a name in /etc/hostname, then you can use that instead. But you have to make sure that the name resolves to something real. If it is not in the DNS, then add it to your /etc/hosts and let it resolve to another loopback address. Here is a sample:
127.0.0.1 localhost
127.0.1.1 myhostname
But as I said, this is quick and dirty and there are much better ways of doing it. So lets take a look at the preferred method. This one differs depending on the Ubuntu version, because the default Apache version changed from 2.2 to 2.4.
Ubuntu 13.04 and older (Apache 2.2)
Apache 2.2 loads additional configuration files from /etc/apache2/conf.d. Just add a file to that directory and add the above mentioned ServerName directive and restart Apache.
Create the file:
vi /etc/apache2/conf.d/servername
Add the directive:
ServerName localhost
Restart Apache:
service apache2 restart
or
/etc/init.d/apache2 restart
Ubuntu 13.10 and newer (Apache 2.4)
Apache 2.4 has the additional configuration organized similar to the modules and sites. All configuration files need to be added to the directory /etc/apache2/conf-available and need to have the extension .conf. Each configuration file can be enabled with a2enconf and disabled with a2disconf.
Create the file:
vi /etc/apache2/conf-available/servername.conf
Add the directive:
ServerName localhost
Activate the configuration:
a2enconf servername
Restart Apache:
service apache2 restart