nginx有一个模块 StubStatus,可以提供监控nginx的当前状态的功能,它能够获取nginx自上次启动以来的工作状态。这个模块需要在安装的时候手工指定相关参数。命令如下:./configure --with-http_stub_status_module
配置方法如下:
location /nginxstatus { stub_status on; access_log logs/nginxstatus.log; auth_basic "nginxstatus"; auth_basic_user_file htpasswd; } [root@lvs conf]# htpasswd -c htpasswd nginxadmin New password: Re-type new password: Adding password for user nginxadmin [root@lvs conf]#简单的配置就完成了。接着在浏览器中输入:
就可以看到状态信息了:
Active connections: 2 server accepts handled requests 8 8 82 Reading: 1 Writing: 1 Waiting: 0