Apache: how to list virtual hosts that are currently configured on my Apache server ?
How can I see what virtual hosts are currently configured on my Apache server ?
Instead of checking the httpd.conf file or the included alternate files of apache, using the "-S" option.
Code:
# /opt/apache/bin/httpd -h
Usage: /opt/apache/bin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
List virtual hosts in apache
Code:
# /opt/apache/bin/httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server www.example.com (/opt/apache/conf/vhosts.d/www.example.com.conf:2)
port 80 namevhost forum.example.com (/opt/apache/conf/vhosts.d/forum.example.com.conf:2)
*:443 is a NameVirtualHost
default server https.example.com (/opt/apache/conf/vhosts.d/https.conf:6)
port 443 namevhost .test.https.example.com (/opt/apache/conf/vhosts.d/https.conf:6)
Syntax OK