码迷,mamicode.com
首页 > 其他好文 > 详细

NGINX 之 状态模块实战 之五

时间:2018-07-16 18:01:39      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:local   server   tls   vhost   read   本机   监控   accept   状态   

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 之 状态模块实战 之五

标签:local   server   tls   vhost   read   本机   监控   accept   状态   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!