Nginx配置检测服务状态的实现方法
1. 查看是否安装检查状态模块;
[root@localhost~]#nginx-V nginxversion:nginx/1.12.2 builtbygcc4.8.520150623(RedHat4.8.5-36)(GCC) configurearguments:--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&&makeinstall
3. 编辑nginx的配置文件;
[root@localhost~]#vim/usr/local/nginx/conf/nginx.conf
server{
listen80;
server_namelocalhost;
#access_loglogs/host.access.logmain;
location/nginx_status{
stub_statuson;
access_logoff;
#allow127.0.0.1;##可对该页面的访问者进行过滤
#denyall;
}
}
[root@localhost~]#nginx-t
nginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisok
nginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful
[root@localhost~]#nginx-sreload
4.测试语法;
[root@localhost~]#curlhttp://192.168.10.110:80/nginx_status Activeconnections:1 serveracceptshandledrequests 111 Reading:0Writing:1Waiting:0
5. 输出内容详解;
第一行 Active connections: 1 ——活跃的连接数量,包括等待客户端数0
第二行 serveracceptshandledrequests——总共处理了1个连接,成功创建1次握手,总共处理了1个请求
第三行Reading—读取客户端的连接数,Writing—响应数据到客户端的数量,Waiting—开启keep-alive的情况下,这个值等于active–(reading+writing),意思就是Nginx已经处理完正在等候下一次请求指令的驻留连接.
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
热门推荐
1 泰迪狗狗如何训练
3 狗狗训练图
5 狗狗训练方法
6 训练狗狗不咬人
8 敏捷训练狗狗
10 训练狗狗吃饭
11 泰迪狗狗训练
12 狗狗从多大开始训练
13 狗狗训练学校费用
14 怎么去训练狗狗
15 狗狗训练狗狗
16 狗狗训练教程
17 训练狗狗装死
18 泰迪狗狗的训练方法