GrepBoard/Manuals
605 manuals ·

Fix Apache AH00558: Could not determine the server's FQDN

·Tested on Ubuntu 24.04 · Apache 2.4.58 (unpacked package, tested on port 18701)·Test scope ↓·6 steps

If apache2ctl configtest or a reload prints AH00558, add a global ServerName. It is only a warning: the server still answered 200 with and without it.

If apache2ctl configtest or a reload prints the line below, Apache could not work out the server's fully qualified host name. The syntax is fine; the fix is one ServerName line.

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

[1] Confirm it is a warning, not an error. With Apache 2.4.58 started from a config that has no ServerName, configtest still printed Syntax OK and exited 0.

console
$ apache2ctl configtestAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.0.2.10. Set the 'ServerName' directive globally to suppress this messageSyntax OK$ echo $?0

[2] Check that the server answers. The same config returned 200.

console
$ curl -si http://127.0.0.1/ | sed -n '1p;$p'HTTP/1.1 200 OKok

[3] Know when it appears. Per the official docs, with no ServerName Apache first asks the operating system for the system host name, and if that fails it does a reverse lookup on an IP address on the system. If the name cannot be resolved to an IP address, startup prints the warning, and the docs say the name used is "almost never the hostname you actually want".

The names the system knows are shown by hostname and hostname -f.

[4] Add a global ServerName. The Ubuntu/Debian package ships none: searching its apache2.conf and conf-available/ found no ServerName. Put it in its own file and enable it with a2enconf.

/etc/apache2/conf-available/servername.conf
ServerName example.com

The value is a domain name (with optional port) or an IP address.

[5] Enable the file. a2enconf only creates a symlink in conf-enabled/; the IncludeOptional conf-enabled/*.conf line in the main config reads it.

console
# a2enconf servernameEnabling conf servername.To activate the new configuration, you need to run:  systemctl reload apache2

[6] Test again. The warning is gone. In the test, after adding ServerName example.com the -t output was the single line Syntax OK, and the server returned the same 200.

console
# apache2ctl configtestSyntax OK# systemctl reload apache2

Source: Apache HTTP Server 2.4 — ServerName

Analyze your Apache log in the browser ↗ — nothing is uploaded.

#apache#servername#configtest