首页 > 其他 > 详细

NGINX 之 状态模块实战 之五

时间:2018-07-16 17:54:13      阅读:257      评论:0      收藏:0      [点我收藏+]
1、检查NGINX是否安装了状态模块
[root@localhost nginx-1.6.3]# ./sbin/nginx -V        #--with-http_stub_status_module
nginx version: nginx/1.6.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 
TLS SNI support enabled
configure arguments: --user=www --group=www --with-http_ssl_module --prefix=/app/nginx-1.6.3 --with-http_stub_status_module

2、配置加载该模块

[root@localhost nginx-1.6.3]# vi conf/vhost/default.conf
server {
    listen       80;
    server_name  localhost;
    location / {
        root   html;
        index  index.html index.htm;
    }
    location /nginx_status {                   #nginx状态监控URL访问地址
        stub_status on;                            #启动状态监控
        access_log off;                             #关闭状态模块的日志功能,不影响正常日志
        allow 127.0.0.1;                            #只允许本机访问
        deny all;                                        #拒绝所有
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

3、获取Nginx监控状态值

[root@localhost nginx-1.6.3]# curl http://127.0.0.1/nginx_status
Active connections: 1 
server accepts handled requests
 2 2 2 
Reading: 0 Writing: 1 Waiting: 0 

NGINX 之 状态模块实战 之五

原文:http://blog.51cto.com/12965094/2144980

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!