nginx status介绍
nginx软件的功能模块中有一个ngx_http_stub_status_module模块,这个模块的主要功能是记录nginx的基本访问状态信息,让使用者了解nginx的工作状态,例如:连接数等信息。要想使用状态模块,在编译nginx时必须增加http_stub_status_module支持。
可通过如下方法检查编译安装nginx时是否设定支持上述模块支持:
|
1
2
3
4
5
|
[[email protected] extra]# /application/nginx/sbin/nginx -V #检查编译安装时设定的编译参数
nginx version: nginx/1.6.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) TLS SNI support enabledconfigure arguments: --user=www --group=www --with-http_ssl_module --with-http_sub_module --prefix=/application/nginx-1.6.3/
|
上述可以查看编译的时候没有安装 --with-http_stub_status_module enable ngx_http_stub_status_module 状态模块。
直接生成status.conf配置文件
|
1
2
3
4
5
6
7
8
9
10
|
[[email protected] extra]# vim /application/nginx/conf/extra/status.conf
#statusserver{ listen 80;
server_name status.etiantian.org;
location / {
stub_status on;
access_log off;
}
}
|
|
1
|
[[email protected] extra]# /application/nginx/sbin/nginx -s reload
|
在window中C:\Windows\System32\drivers\etc\hosts再增加一个域名解析:10.0.0.8 status.etiantian.org
然后在windows的ie中访问status.etiantian.org,会出现如下信息:
当然也可以限制查看状态
本文转自sandshell博客51CTO博客,原文链接http://blog.51cto.com/sandshell/1957818如需转载请自行联系原作者
sandshell