1. 查看是否安装检查状态模块;
?
1
2
3
4
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
?
1
2
3
[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
3. 编辑nginx 的配置文件;
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[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.测试语法;
?
1
2
3
4
5
[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
5. 输出内容详解;
第一行 Active connections: 1 ——活跃的连接数量,包括等待客户端数0
第二行 server accepts handled requests —— 总共处理了1个连接 , 成功创建1次握手, 总共处理了1个请求
第三行 Reading — 读取客户端的连接数,Writing — 响应数据到客户端的数量,Waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.51cto.com/13776311/2391358
声明: 猿站网有关资源均来自网络搜集与网友提供,任何涉及商业盈利目的的均不得使用,否则产生的一切后果将由您自己承担! 本平台资源仅供个人学习交流、测试使用 所有内容请在下载后24小时内删除,制止非法恶意传播,不对任何下载或转载者造成的危害负任何法律责任!也请大家支持、购置正版! 。本站一律禁止以任何方式发布或转载任何违法的相关信息访客发现请向站长举报,会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。本网站的资源部分来源于网络,如有侵权烦请发送邮件至:2697268773@qq.com进行处理。