After installing Apache2 on Ubuntu you might run into a non-fetal problem – its really just a missing ServerName in one of the apache configuration files. Normally the ServerName should just be filled out in the individual vhosts – but this problem is most likely the result of a fresh apache2 installation running on localhost, where ServerName is missing entiely from httpd.conf.
Yes. httpd.conf might be completely empty – but that doesn't matter – just edit it anyway!
The message in terminal looks like:
Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Including ServerName in httpd.conf
To avoid the message we need to include the below somewhere in http.conf.
To do this we need to edit the http.conf file – simply opening it normally will most likely not allow you to save it, due to user rights – so we have to use sudo, enter the below command in terminal to avoid this problem.
sudo gedit /etc/apache2/httpd.conf
Note. You can replace gedit with whatever editor you got installed.
Finally you can try restarting apache to see if the message still appears.
sudo /etc/init.d/apache2 restart