Apache2 – Set ServerName Directive Globally

Keep reading below for information on how to fix the following Apache2 error message:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, 
using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

In most cases, you’ll see this error message printed to terminal when the apache2 service is started, restarted, or when you’re reviewing the apache2 error logs (located in the “/var/log/apache2/” directory on a Debian system).

The fix for this configuration error is simple: all you have to do is edit your “/etc/apache2/apache2.conf” file, adding a global ServerName directive. Note that this global directive is required to eliminate the error message even if you already have a virtual server configured with its own ServerName directive.

Here are the steps to add the global ServerName directive.

Open the apache2.conf file with the nano editor:

$ sudo nano /etc/apache2/apache2.conf

Then add the following line below the “# Global configuration” section using your server’s IP address. For example, the IP address of my server is 10.0.0.113 :

ServerName 10.0.0.113

Save your changes and exit nano, then reload the apache2 service with systemctl:

$ sudo systemctl reload apache2

When you restart your apache2 service, the error message should be gone.