Ffile2fix
Sign in Get started

How to fix Apache "Could not reliably determine the server's FQDN"

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

Apache could not find a global ServerName and fell back to the machine's IP or hostname. This is only a warning and does not stop Apache from serving sites. If Apache also fails to start, the real cause is a different error further down the output.

Also appears as: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message · apache2: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName · httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.10 for ServerName

Common causes

  • No ServerName directive in the main config (apache2.conf or httpd.conf)
  • The server's hostname has no matching entry in /etc/hosts
  • A fresh Apache install where only virtual hosts define ServerName
  • A container image where the hostname is a random ID
  • The hostname is not a fully qualified domain name

How to fix it

  1. Set a global ServerName on Debian/Ubuntu. Create /etc/apache2/conf-available/servername.conf with the line ServerName localhost (or your real hostname). Enable it with sudo a2enconf servername.
  2. Set it on RHEL, CentOS or Alma. Open /etc/httpd/conf/httpd.conf, find the commented #ServerName www.example.com:80 line, and set ServerName localhost or your server's FQDN.
  3. Test and reload. Run sudo apachectl configtest. It should print Syntax OK without the AH00558 warning. Then run sudo systemctl reload apache2 (or httpd).
  4. Check the hostname mapping. Run hostname -f. If it fails, add a line such as 127.0.1.1 server1.example.com server1 to /etc/hosts.
  5. Look for the real error if Apache will not start. If Apache still fails, run sudo journalctl -u apache2 -n 50. Errors like port already in use or a syntax error are the actual problem.

Add a global ServerName on Debian/Ubuntu

echo 'ServerName localhost' | sudo tee /etc/apache2/conf-available/servername.conf
sudo a2enconf servername
sudo apachectl configtest
sudo systemctl reload apache2

How to stop it happening again

  • Set a global ServerName in your provisioning script
  • Give servers a proper FQDN hostname
  • Keep ServerName set in every virtual host too
  • Read the full configtest output, not just the first line

Frequently asked questions

Does AH00558 break my website?

No. It is a warning. Apache still starts and serves sites using the ServerName in each virtual host.

Which ServerName should I use?

Use the server's real hostname, such as server1.example.com. localhost works fine just to silence the warning.

I set ServerName in my virtual host. Why do I still see it?

The warning is about the global server config. A ServerName inside a VirtualHost block does not count; add one outside it.