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.
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, orsystemctl start/restart/reload apache2. - It also shows up in
journalctl -xeor in your Docker container logs. - Apache still starts and the site still works.
The usual causes, most common first:
- No global ServerName
- Neither
apache2.confnorhttpd.confsetsServerName. AServerNamethat 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/hostsor 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
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.
- Open
/etc/apache2/apache2.conf(Debian/Ubuntu) in an editor with root rights. - Add this line near the top, outside any
<VirtualHost>block. Replace the name with your own.ServerName example.com - Save the file.
2.Check the config and reload Apache
Confirms the syntax is valid and that the warning is gone before you rely on it.
- Run the config test. You want
Syntax OKand no AH00558 line.sudo apache2ctl configtest - Reload Apache.
sudo systemctl reload apache2
Check that it worked
sudo apache2ctl configtestprintsSyntax OKwith 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
ServerNameand 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
- Apache Core Features: ServerName directiveOfficial · Apache Software Foundation
- Apache HTTP Server 2.4 Virtual Host MatchingOfficial · Apache Software Foundation
- Apache HTTP Server 2.4 Server-Wide ConfigurationOfficial · Apache Software Foundation