How is namevhost derived in output of "apache2ctl -S" command?

by StevieD   Last Updated October 19, 2019 20:00 PM - source

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 server_hostname.server_domain_name.com for namevhost instead of something the usual www.anotherwebstiedomain.com.

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?

Tags : apache-2.4


Answers 2


The domains showing up as server_hostname.server_domain.com do not have the apache ServerName directive set.

StevieD
StevieD
October 19, 2019 21:15 PM

From the Apache 2.4 Name-based Virtual Host Support documentation:

If you omit the ServerName directive 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 ServerName Directive:

If no ServerName is 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.

Esa Jokinen
Esa Jokinen
October 20, 2019 11:40 AM

Related Questions


Forward proxy with rotating IP

Updated January 11, 2016 08:00 AM

Configuration or command to see ssl certificate

Updated November 12, 2018 19:00 PM