nginx系列(十三)nginx下的监控模块

nginx里面,默认监控模块是不安装的要自行安装才可以。
安装命令:关键是(--with-http_stub_status_module)

./configure --prefix=/opt/nginx/nginx-1.9.5 --with-http_stub_status_module
make -j4
make install -j4


增加配置:

location /nginx_status {
# Turn on nginx stats
stub_status on;
# I do not need logs for stats
access_log off;
# Security: Only allow access from 192.168.1.100 IP
allow 192.168.56.0/24;
allow 172.19.136.0/24; #pc
allow 172.19.137.0/24; #wifi
# Send rest of the world to /dev/null #
deny all;
}

其中访问策略配置很关键,否则这个技术等于垃圾,公网访问安全性会很差。前面的IP表示网段,斜杠后面的24表示子网。细节请大家自行学习,或者跟帖交流。

访问监控地址:返回如下:
Active connections: 70
server accepts handled requests
14553819 14553819 19239266
Reading: 0 Writing: 3 Waiting: 67

NginxStatus 显示的内容意思如下:
active connections – 当前 Nginx 正处理的活动连接数。
server accepts handled requests -- 总共处理了 14553819 个连接 , 成功创建 14553819 次握手 ( 证明中间没有失败的 ), 总共处理了 19239266 个请求 ( 平均每次握手处理了 1.3 个数据请求 )。
reading -- nginx 读取到客户端的 Header 信息数。
writing -- nginx 返回给客户端的 Header 信息数。
waiting -- 开启 keep-alive 的情况下,这个值等于 active - (reading + writing),意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接。

参考文章
请求返回参数含义
http://www.ibm.com/developerworks/cn/web/wa-lo-nginx/
安装参考
http://www.cnblogs.com/94cool/p/3872492.html
allow和deny
http://www.111cn.net/sys/nginx/63713.htm
子网划分
http://zhidao.baidu.com/link?url=av8E4A20cMw6VYBb-1JRHFnOnoPpATuPs2pTR64dSsLs2XJ-d2UOeqEB_wWL0L21BiA5x17gs3Iugl8Eq8yCCa
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值