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

AH00558 is a startup warning, not a failure. Apache has no global `ServerName`, so it used whatever hostname it could find. Set `ServerName` once outside any VirtualHost, run a config test, and reload.

Applies to:Apache HTTP Server2.4.xDebian / Ubuntu (apache2)RHEL / CentOS

What it means

The message starts with AH00558 and says Apache could not reliably determine the server's fully qualified domain name. It then names the host name it used instead, and the tail of the line suggests setting the ServerName directive globally. The name or address shown at the end differs from machine to machine.\n\nSee the ServerName directive in the Apache docs.\n\nIf you have a 500 error or Apache will not start at all, this warning is probably not the cause. Look in the Apache error log for the line that actually reports the failure.

Symptoms and causes

You are likely dealing with this problem if:

  • The AH00558 line appears when you run apache2ctl configtest, apachectl start, or systemctl start/restart/reload apache2.
  • It also shows up in journalctl -xe or in your Docker container logs.
  • Apache still starts and the site still works.

The usual causes, most common first:

No global ServerName
Neither apache2.conf nor httpd.conf sets ServerName. A ServerName that exists only inside a <VirtualHost> block does not silence the warning.
Hostname does not resolve to an IP address
The system hostname has no usable entry in /etc/hosts or DNS, so Apache has no resolvable name to use.
Fresh install or Docker image
New installs and containers often have a random or minimal hostname, so Apache has nothing sensible to use.

How to fix it

Work through these in order. They start with the quickest, safest checks and move to deeper repairs; stop as soon as the problem is gone.

1.Or put ServerName in the main config file

EasyChanges settings

Puts the setting directly in the main config file.

Before you start: Make a copy of the file first, for example sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak.

  1. Open /etc/apache2/apache2.conf (Debian/Ubuntu) in an editor with root rights.
  2. Add this line near the top, outside any <VirtualHost> block. Replace the name with your own.
    Apache config
    ServerName example.com
  3. Save the file.

2.Check the config and reload Apache

Easy

Confirms the syntax is valid and that the warning is gone before you rely on it.

  1. Run the config test. You want Syntax OK and no AH00558 line.
    Terminalneeds sudo / root
    sudo apache2ctl configtest
  2. Reload Apache.
    Terminalneeds sudo / root
    sudo systemctl reload apache2

Check that it worked

  • sudo apache2ctl configtest prints Syntax OK with no AH00558 line.
  • Restarting or reloading the service no longer shows the warning in the terminal or in journalctl.

If it still fails

  • Make sure the line is not only inside a <VirtualHost> block. It must be global.
  • If Apache fails to start, the warning is not the reason. Read the Apache error log for the real error.
  • For a production server, read the Apache documentation on ServerName and name-based virtual hosts, or ask your distribution's support channel.

Questions

Is it safe to ignore AH00558?

Apache keeps working, but the name it picked is probably not the one you want. On a public site set your real domain.

Does ServerName localhost matter for production?

It silences the warning, but it is not your real site name. For production use the actual domain. Also give each name-based VirtualHost its own ServerName, as the Apache virtual host documentation recommends.

Sources

  1. Apache Core Features: ServerName directiveOfficial · Apache Software Foundation
  2. Apache HTTP Server 2.4 Virtual Host MatchingOfficial · Apache Software Foundation
  3. Apache HTTP Server 2.4 Server-Wide ConfigurationOfficial · Apache Software Foundation