Here’s a little tidbit that I never knew until I had an Apache2 name-based virtual host problem: httpd -S lists the vhosts that are being served by Apache, and how they were parsed from the config files.

The output on one of my servers looks something like:

[root@web2 vhosts.d]# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 (/etc/httpd/vhosts.d/ssl-host.conf:7)
*:80                   is a NameVirtualHost
         default server (/etc/httpd/vhosts.d/000-default.conf:1)
         port 80 namevhost (/etc/httpd/vhosts.d/000-default.conf:1)
         port 80 namevhost (/etc/httpd/vhosts.d/
         port 80 namevhost (/etc/httpd/vhosts.d/
Syntax OK

This is quite useful in debugging vhost problems, especially those pesky times when a request that should go to a specific vhost is being served by the default (in my case at this time, I had two ServerName directives instead of a ServerName and a ServerAlias).


comments powered by Disqus