apacheの server-status、server-infoを有効にする | Subaru's Husband

Subaru's Husband

python、linux、バイクなんかのネタを書きます。
一応security業界でご飯を食べてます。
備忘録がメインだと思うので、未来の自分が助かれば最高。

apacheの機能でサーバの稼働状況を調べる為のモジュールが用意されています。
security的にいろんな情報が取得出来るので、普通は無効にしておきます。
でもやられサーバや、securityに興味がある人は一回は設定してみるといいです。
CentOSの場合、/etc/httpd/conf/httpd.confを編集します。

LoadModule status_module modules/mod_status.so  この行が#コメントアウトされてれば#削除
info_module modules/mod_info.so   この行が#コメントアウトされてれば#削除

そして、

# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from .example.com
</Location>

ここの<Location .... の部分の#を削除します。
んで、Allow from をlocalhostからのみアクセス出来るようにします。

Allow from localhost

同じように、<Location /server-info>って設定があるので同様に設定します。
#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
#
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from localhost
</Location>


後は、apacheを再起動して

http://localhost/server-status
http://localhsot/server-info

でアクセスすれば良いだけ。

でも、僕はテストなんで

Allow All

懐が広い設定にします。普通はこんな設定でインターネットに公開してないはずです。