13.04 and older
This is just a friendly warning and not really a problem (as in that something does not work).
If you go to:
/etc/apache2/apache2.conf
and insert:
ServerName localhost
and then restart apache by typing into the terminal:
sudo systemctl reload apache2
the notice will disappear.
If you have a name inside /etc/hostname
you can also use that name instead of localhost
.
And it uses 127.0.1.1
if it is inside your /etc/hosts
:
127.0.0.1 localhost
127.0.1.1 myhostname
Preferred method
Troubleshooting Apache
If you get this error:
apache2: Could not determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName
then use a text editor such as "sudo nano" at the command line or "gksudo gedit" on the desktop to create a new file,
sudo nano /etc/apache2/conf.d/fqdn
or
gksu "gedit /etc/apache2/conf.d/fqdn"
then add
ServerName localhost
to the file and save. This can all be done in a single command with the following:
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
But on Ubuntu 14.04:
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn
Don't forget the ".conf" (without will not work).
ServerName localhost
in it – icc97 Jun 29 '13 at 09:36/etc/apache2/conf.d/
does not exist after my install oflamp-server^
in 14.04 – redanimalwar May 03 '14 at 07:51sudo a2enconf fqdn
though it should technically be the same. – nuala Jun 18 '14 at 15:04fail
in terminal log. and i restart my system but nothing changed and again after restarting apacheservice apache2 restart
, i seefail
! – Netmoon Oct 29 '14 at 15:14ServerName localhost
and then didsudo service apache2 restart
and it worked - no more warning. Before doing that, editing/etc/apache2/httpd.conf
had no effect (I confirmed by removing the file in the line after adding it to apache2.conf and restarting the server) – therobyouknow Jan 15 '17 at 21:06ServerName example.com
– jave.web Jan 19 '24 at 23:59