Apache2 can also get the FQDN from a properly configured system hostname rather than hardcoded into the apache config file. Hardcoding it will also cause confusion if the hostname changes. You actually don't need any
ServerName directives in
httpd.conf or any apache config files.
Put the following in
# IPv4 and IPv6 localhost aliases
127.0.0.1 hostname.domainname.com hostname localhost
::1 hostname.domainname.com hostname localhost
hostname.domainname.com is the FQDN of your machine.
Along with a properly configured hostname in
/etc/hostname/ or with
hostnamectl, this will also help other services on your machine run properly (i.e. the login prompt, showing
This is hostname.domainname.com instead of
This is hostname.unknown_domain.)