[CentOS] バーチャルホストの一覧表示・内容確認

CentOSでバーチャルホストの設定内容を調べたい場合の方法についてです。Virtualhosutの設定がうまくいってるかを調べたり、サーバにどのようなバーチャルホストが設定されているかを調べたりするのに活用できます。

バーチャルホスト一覧表示

バーチャルホストの一覧を表示するには、ターミナルで「httpd -S」を入力します。

 # httpd -S
VirtualHost configuration:
XXX.XXX.XXX.XXX:80     www.example.com (/etc/httpd/conf.d/www.example.com.conf:1)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

DUMP_VHOSTS

こちらのコマンドでもバーチャルホストの一覧と設定内容が表示されます。

# httpd -t -D DUMP_VHOSTS


Author: webmaster