使い方は簡単で、mod_infoモジュールを読み込むようにしておいて、起動時のオプションに -DDUMP_CONFIG を指定すればよい。
http://httpd.apache.org/docs/2.4/en/mod/mod_info.html#startup
-DDUMP_CONFIG実行例
(httpd.conf) ------------------------------------------------- LoadModule info_module modules/mod_info.so -------------------------------------------------
(コマンド実行例)
$ ./httpd -t -DDUMP_CONFIG
# In file: /usr/local/apache249/conf/httpd.conf
# 6:
ServerName www.example.com
# 9:
Listen 80
# 19:
StartServers 1
# 20:
MaxRequestWorkers 3
# 21:
MinSpareThreads 3
# 22:
MaxSpareThreads 3
# 23:
ThreadsPerChild 3
# 24:
MaxConnectionsPerChild 0
# 25:
AsyncRequestWorkerFactor 2
# 41:
KeepAlive on
# 42:
KeepAliveTimeout 5
# 43:
MaxKeepAliveRequests 100
# 50:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
# 51:
CustomLog logs/access_log common
# 60:
LogLevel warn mpm_event:trace6
# 66:
Listen 443
# 71:
SSLRandomSeed startup file:/dev/urandom 256
# 72:
SSLRandomSeed connect builtin
# 74:
SSLSessionCache shmcb:logs/scache(1024000)
# 77:
SSLCryptoDevice builtin
# 81:
SSLFIPS off
# 84:
SSLPassPhraseDialog builtin
# 86:
LogFormat "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" ssl_log
# 88:
<VirtualHost _default_:443>
# 89:
ErrorLog logs/ssl_error_log
# 90:
CustomLog logs/ssl_access_log ssl_log
# 92:
SSLEngine on
# 95:
SSLSessionCacheTimeout 300
# 97:
SSLCertificateFile conf/server.crt
# 98:
SSLCertificateKeyFile conf/server.key
# 102:
SSLProtocol all
# 105:
SSLCipherSuite HIGH:MEDIUM
# 108:
SSLCompression off
# 111:
SSLHonorCipherOrder off
# 114:
SSLInsecureRenegotiation off
</VirtualHost>
# 153:
ExtendedStatus on
# 155:
<Location /server-status>
# 156:
SetHandler server-status
</Location>
# 164:
Alias /cgi-bin /usr/local/apache249/cgi-bin
# 166:
<Directory /usr/local/apache249/cgi-bin>
# 167:
SetHandler cgi-script
# 168:
Options ExecCGI
</Directory>
Syntax OK
ただし、この出力では、既にIfModuleやIncludeは処理済みなので、出力されない。
.htaccessの内容も出力されない。
ServerRootも出力されないが、これは -DDUMP_RUN_CFG オプションを指定すれば出力される。
LoadModuleも出力されないが、これは -M オプションを指定すれば分かる。
-DDUMP_RUN_CFGの出力例
$ ./httpd -t -DDUMP_RUN_CFG ServerRoot: "/usr/local/apache249" Main DocumentRoot: "/usr/local/apache249/htdocs" Main ErrorLog: "/usr/local/apache249/logs/error_log" Mutex ssl-stapling: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/usr/local/apache249/logs/" mechanism=default PidFile: "/usr/local/apache249/logs/httpd.pid" Define: DUMP_RUN_CFG User: name="#-1" id=4294967295 not_used Group: name="#-1" id=4294967295 not_used
-Mオプションの出力例
$ ./httpd -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (shared) unixd_module (shared) authz_core_module (shared) log_config_module (shared) mime_module (shared) ssl_module (shared) socache_shmcb_module (shared) status_module (shared) alias_module (shared) cgid_module (shared) info_module (shared)
ときどき、読み込まれた設定を確認したいことがあり、mod_infoで ?config クエリを使っていたりしたが、 mod_infoのステータス画面の出力設定を残すのが嫌な場合もあった。
これなら起動時に確認され、infoページへのアクセスの設定もないので、都合がよさそうだ。
ただし、今、実行中のプロセスの設定内容を出力させるには、mod_infoの情報ページにアクセスしなくてはならないようだ。
注意点
-DDUMP_CONFIGは読み込んだ設定情報を出力しているだけで、有効な設定だけを出力しているわけではない。
たとえば、設定ファイルに重複した設定があった場合、
その内容がそのまま出力される。
StartServers 1 StartServers 10
その内容がそのまま出力される。
$ ./httpd -t -DDUMP_CONFIG # In file: /usr/local/apache249/conf/httpd.conf # 6: PidFile conf/httpd.pid # 9: ServerName www.example.com # 12: Listen 80 # 22: StartServers 1 # 23: StartServers 10 :
0 件のコメント:
コメントを投稿