When I run
apache2ctl -S on my server, I mostly get something like this for each website on the server:
port * namevhost www.websitedomain.org (/etc/apache2/sites-enabled/websitedomain.conf:29)
Notice that the string after
namevhost matches the domain name for the web site.
However, there are a few dozen websites on the server that report the web server's host name followed by the domain name for the
namevhost setting, like this:
port * namevhost server_hostname.server_domain_name.com (/etc/apache2/sites-enabled/anotherwebsitedomain.conf:29)
I'm trying to figure out why these sites are showing
namevhost instead of something the usual
I've grepped through the apache configuration files and I do not see that
server_hostname.server_domain_name.com is anywhere in the configuration. So where might this string for
namevhost be coming from?
The domains showing up as
server_hostname.server_domain.com do not have the apache
ServerName directive set.
From the Apache 2.4 Name-based Virtual Host Support documentation:
If you omit the
ServerNamedirective from any name-based virtual host, the server will default to a fully qualified domain name (FQDN) derived from the system hostname. This implicitly set server name can lead to counter-intuitive virtual host matching and is discouraged.
How this is done exactly is explained in the documentation of the
ServerNameis specified, the server attempts to deduce the client visible hostname by first asking the operating system for the system hostname, and if that fails, performing a reverse lookup on an IP address present on the system.
That's where the hostname you see comes from.