nginx信息功能启用

 --with-http_stub_status_module  这个模块功能是记录nginx基本信息访问状态
1、检查编译是否有这个功能模块。
 [root@slave nginx]# /usr/sbin/nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre
[root@slave nginx]# 
2、在目录下添加server段
##status
   server {
        listen       80;
        server_name  status.wolf.com;
        location / {
            stub_status on;
            access_log off;
        }
    }
3、添加hosts
[root@slave nginx]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.203 www.wolf.com bbs.wolf.com blog.wolf.com   wolf.com status.wolf.com
笔记本添加
[root@slave nginx]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.203 www.wolf.com bbs.wolf.com blog.wolf.com   wolf.com status.wolf.com


4、语法检查
[root@slave nginx]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


5、重启服务
[root@slave nginx]# /usr/sbin/nginx -s reload


6、测试


浏览器http://status.wolf.com/访问
Active connections: 5 
server accepts handled requests
 54 54 408 
Reading: 0 Writing: 1 Waiting: 4


[root@slave nginx]# curl status.wolf.com
Active connections: 6 
server accepts handled requests
 55 55 414 
Reading: 0 Writing: 1 Waiting: 5


7、访问限制
##status
   server {
        listen       80;
        server_name  status.wolf.com;
        location / {
            stub_status on;
            access_log off;
allow 192.168.0.0/24;
deny all;
        }
    }
8、访问log说明
active connections – 活跃的连接数量
server accepts handled requests — 总共处理了11989个连接 , 成功创建11989次握手, 总共处理了11991个请求
reading — 读取客户端的连接数.
writing — 响应数据到客户端的数量
waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值