Resolving "AH00558: Could not reliably determine the server's fully qualified domain name"

The Apache AH00558: Could not reliably determine the server's fully qualified domain name message is generated when Apache is not configured with a global ServerName directive. This is he message is mainly for informational purposes, and an AH00558 error will not prevent Apache from running correctly.

$ sudo apache2ctl configtest
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
Syntax OK

Likewise, when restarting the Apache service, we can also get the same error:

$ sudo systemctl restart apache2
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

The simplest method to resolve this message is to set the ServerName in the correct Apache configuration file. The table below lists some of the locations that I have amended to make these changes across various platforms:

 

Table 1 — Default ServerName location
OSApache
Version
File location / Action
Solaris 9 1.3x
  1. Edit /etc/apache/httpd.conf
  2. Add ServerName YourDomain.com
  3. Restart Apache

Ubuntu 13.04

Ubuntu 13.10

Ubuntu 16.04

2.4
  1. Edit /etc/apache2/apache2.conf
  2. Add ServerName YourDomain.com
  3. Restart Apache
Fedora 12 --
  1. Edit /etc/httpd/conf/httpd.conf
  2. Add ServerName YourDomain.com
  3. Restart Apache

Debian 10

Ubuntu 18.04

2.4.10
  1. Edit /etc/apache2/sites-available/YourDomain.conf
  2. Add ServerName YourDomain.com
  3. Restart Apache
macOS --
  1. Edit /etc/apache2/httpd.conf
  2. Add ServerName YourDomain.com
  3. Restart Apache

* Replace YourDomain.com with your actual FQDN of your webserver.