GrepBoard/Manuals
605 manuals ·

Fix httpd AH00558 Could not reliably determine FQDN on Rocky 9

·Tested on Rocky Linux 9.8 (Docker rockylinux:9) · httpd 2.4.62 · 2026-10·Test scope ↓·4 steps

Silence AH00558 on Rocky 9 httpd with one global ServerName file in /etc/httpd/conf.d/. A VirtualHost ServerName is not enough; an FQDN hostname also works.

output
AH00558: httpd: 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

It is only a warning, and the server still starts. Telling the warning from a real error (Syntax OK, the exit code, a 200 response), the fact that it goes to standard error and journalctl rather than error_log, and the order httpd uses to pick a name are the same as with Ubuntu's apache2; see Fix Apache AH00558 ServerName warning. This page covers only what differs on Rocky 9: there is no a2enconf, and the config lives under /etc/httpd/.

[1] Find where ServerName belongs in the stock config and which line pulls in extra files. Rocky's httpd.conf has only a commented example on line 100, and reads conf.d/*.conf near the end.

console
# grep -n 'ServerName' /etc/httpd/conf/httpd.conf94:# ServerName gives the name and port that the server uses to identify itself.100:#ServerName www.example.com:80# grep -n '^IncludeOptional' /etc/httpd/conf/httpd.conf358:IncludeOptional conf.d/*.conf

Any .conf file in conf.d/ is read with no enable step. A file whose name does not end in .conf is not read.

[2] Add a global ServerName in conf.d. Editing the packaged httpd.conf also works, but a separate file makes the change easy to see and undo. The value is name[:port]; use a name that resolves to an IP address on the server.

/etc/httpd/conf.d/servername.conf
ServerName www.example.com:80
console
# httpd -t; echo $?Syntax OK0

The warning is gone and only Syntax OK remains. Apply it with systemctl reload httpd. In the test, httpd -k graceful was followed by the same 200 response. To undo, delete the file, run httpd -t, and reload again.

[3] A ServerName inside a virtual host does not replace the global line. With no global line and a single virtual host in conf.d/vhost.conf:

console
# cat /etc/httpd/conf.d/vhost.conf<VirtualHost *:80>    ServerName www.example.com</VirtualHost># httpd -tAH00558: httpd: 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

The warning stays. On a server with several name-based virtual hosts, keep the file from [2] as well.

[4] Making the hostname resolve as an FQDN instead also removed the warning. The default container had a short name (hostname -f also printed server1) and warned; a container started with Docker --hostname web1.example.com was quiet:

console
# hostname; hostname -fweb1.example.comweb1.example.com# grep web1 /etc/hosts192.0.2.10	web1.example.com web1# httpd -t; echo $?Syntax OK0

On a real server this means changing the system hostname and /etc/hosts. ⚠️ Other programs use the hostname too: mail, monitoring registration, cluster membership. If the goal is only to silence the web server, [2] has the smaller blast radius. If you change it anyway, save the original values first:

console
# hostnamectl hostname | tee /root/hostname.orig# cp -p /etc/hosts /root/hosts.orig# hostnamectl set-hostname web1.example.com

Add one line <server's real IP> web1.example.com web1 to /etc/hosts. The 192.0.2.10 above is a documentation address; do not copy it. Check that hostname -f returns the FQDN, then run httpd -t and systemctl reload httpd. If something breaks, restore the saved values and check again:

console
# hostnamectl set-hostname "$(cat /root/hostname.orig)"# cp -p /root/hosts.orig /etc/hosts# hostname -f; httpd -t

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

#httpd#apache#servername#rocky