首先 server-status和server-info 依賴於/usr/local/apache2/conf/extra/httpd-info.confapache
因而去/usr/local/apache2/conf/extra/httpd-info.conf中修改配置,能夠修改以下:dom
#
# Get information about the requests being processed by the server
# and the configuration of the server.
#
# Required modules: mod_status (for the server-status handler),
# mod_info (for the server-info handler)
#
# 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 localhost
</Location>
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
ExtendedStatus On
#
# 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>
測試
本地測試的狀況能夠設置爲監控localhost,另外要將ExtendedStatus On打開ui
而後咱們須要保證apache已經安裝mod_status和mod_info模塊,能夠用如下命令查看:spa
apache2 -l 或者 httpd -l.net
獲得結果以下:orm
root@junjie :/home/andy/Downloads/httpd-2.2.25# apache -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_cache.c
mod_mem_cache.c
mod_include.c
mod_filter.c
mod_log_config.c
mod_env.c
mod_mime_magic.c
mod_expires.c
mod_headers.c
mod_usertrack.c
mod_unique_id.c
mod_setenvif.c
mod_version.c
mod_proxy.c
mod_proxy_connect.c
mod_proxy_ftp.c
mod_proxy_http.c
mod_proxy_scgi.c
mod_proxy_ajp.c
mod_proxy_balancer.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_asis.c
mod_info.c
mod_negotiation.c
mod_dir.c
mod_alias.c
mod_rewrite.c
mod_so.c
server
能夠看到已經安裝加載的apache模塊rem
若是結果中沒有mod_status.so和mod_info.so,那麼你須要從新編譯安裝apache,例如:get
./configure --enable-module=so --enable-info
從新編譯安裝apache,注意make clean
若是上面一切執行完畢以後,咱們就須要修改配置:httpd.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
而後咱們重啓apache就能夠訪問了:
http://localhost/server-status
2. 經過http://<servername>/server-status?refresh=1,可每秒刷新一次頁面。 3. 經過http://<servername>/server-status?auto可看到以下信息: