Nginx配置检测服务状态的实现方法
2019/7/10 21:11:19
本文主要是介绍Nginx配置检测服务状态的实现方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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
3. 编辑nginx 的配置文件;
[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
5. 输出内容详解;
第一行 Active connections: 1 ——活跃的连接数量,包括等待客户端数0 |
第二行 server accepts handled requests —— 总共处理了1个连接 , 成功创建1次握手, 总共处理了1个请求 |
第三行 Reading — 读取客户端的连接数,Writing — 响应数据到客户端的数量,Waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接. |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持找一找教程网。
这篇关于Nginx配置检测服务状态的实现方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-17Nginx实用篇:实现负载均衡、限流与动静分离
- 2024-08-21宝塔nginx新增8022端口方法步骤-icode9专业技术文章分享
- 2024-08-21nginx配置,让ws升级为wss访问的方法步骤-icode9专业技术文章分享
- 2024-08-15nginx ws代理配置方法步骤-icode9专业技术文章分享
- 2024-08-14nginx 让访问带有/relid的地址返回404 ,例子 /relid-x-0.36-y-131.html-icode9专业技术文章分享
- 2024-08-14nginx 判断地址有/statics/的路径,指向到/home/html/statics/目录-icode9专业技术文章分享
- 2024-07-24解锁Nginx日志的宝藏:GoAccess——你的实时、交互式Web日志分析神器!
- 2024-03-29fail2ban nginx
- 2024-03-18install nginx proxy manager
- 2024-01-2444从零开始用Rust编写nginx,命令行参数的设计与解析及说明