13.10 or newer
As of Apache 2.4 - which is available by default as of 13.10 - you cannot use the method about adding a config file in the
Apache no longer uses the
conf.d directory. All the configuration files are stored inside
/etc/apache2/conf-available directory and all the configuration files should now have a
In order to solve this message in Apache 2.4, we have to create a configuration file inside the conf-available directory. For example
sudo vi /etc/apache2/conf-available/servername.conf
And inside this we just need to add one line
You can combine the previous two commands in one with:
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/servername.conf
If you want to use a domain name or any other name depending on the requirement its fine, just replace
localhost with whatever you need. Next you have to enable this configuration. For this, you need to run the following command:
sudo a2enconf servername
a2enconf is a command to enable a configuration file in Apaches 2.4. Also note that
servername on the above command is from the name of the configuration file
servername.conf. If your configuration file was
ngenericserver.conf then you would have to write
sudo a2enconf ngenericserver.
After this reload the server and the above message will no longer bug you.
sudo service apache2 reload
sudo apache2ctl graceful
Now after this you will see that the message will not be shown again and the problem will be fixed.