1. 查看是否安装检查状态模块;
[root@localhost ~]# Nginx -V Nginx version: Nginx/1.12.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) configure arguments: --prefix=/usr/local/Nginx --with-http_sub_module
2. 如未安装,重新编译安装;
Ø 检查状态模块;--with-http_stub_status_module
[root@localhost ~]# cd /usr/local/src/Nginx-1.12.2/ [root@localhost ~]# ./configure --prefix=/usr/local/Nginx --with-http_stub_status_module [root@localhost ~]# make && make install
[root@localhost ~]# vim /usr/local/Nginx/conf/Nginx.conf server { listen 80; server_name localhost; #access_log logs/host.access.log main; location /Nginx_status { stub_status on; access_log off; #allow 127.0.0.1; ##可对该页面的访问者进行过滤 #deny all; } } [root@localhost ~]# Nginx -t Nginx: the configuration file /usr/local/Nginx/conf/Nginx.conf Syntax is ok Nginx: configuration file /usr/local/Nginx/conf/Nginx.conf test is successful [root@localhost ~]# Nginx -s reload
4. 测试语法;
[root@localhost ~]# curl http://192.168.10.110:80/Nginx_status Active connections: 1 server accepts handled requests 1 1 1 Reading: 0 Writing: 1 Waiting: 0
第一行 Active connections: 1 ——活跃的连接数量,包括等待客户端数0 |
第二行 server accepts handled requests —— 总共处理了1个连接 , 成功创建1次握手, 总共处理了1个请求 |
第三行 Reading — 读取客户端的连接数,Writing — 响应数据到客户端的数量,Waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接. |
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。