博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
编译安装 nginx的http_stub_status_module监控其运行状态
阅读量:6857 次
发布时间:2019-06-26

本文共 1120 字,大约阅读时间需要 3 分钟。

步骤:

1 编译nginx,加上参数 --with-http_stub_status_module

以我自己的编译选项为例:

#配置指令  ./configure --prefix=/usr/local    --user=nginx     --group=nginx    --with-http_ssl_module    --with-http_realip_module    --http-client-body-temp-path=/usr/local/var/tmp/nginx/client --http-proxy-temp-path=/usr/local/var/tmp/nginx/proxy --http-fastcgi-temp-path=/usr/local/var/tmp/nginx/fcgi --http-scgi-temp-path=/usr/local/var/tmp/nginx/scgi --http-uwsgi-temp-path=/usr/local/var/tmp/nginx/uwsgi --with-http_geoip_module --with-http_stub_status_module

2 修改nginx配置文件,添加监控状态配置

在nginx.conf的server块中添加如下代码

location /nginx_status {    # Turn on nginx stats    stub_status on;    # I do not need logs for stats    access_log off; # Security: Only allow access from 192.168.1.100 IP # #allow 192.168.1.100; # Send rest of the world to /dev/null # #deny all; }

这段代码是加在默认的server里的,

假设默认server的配置为

listen       127.0.0.1:80;server_name  127.0.0.1;

那么访问nginx的状态,就可以通过 curl 127.0.0.1/nginx_status访问了

返回结果类似于:

Active connections: 1 server accepts handled requests 655 655 1985 Reading: 0 Writing: 1 Waiting: 0

转载于:https://www.cnblogs.com/94cool/p/3872492.html

你可能感兴趣的文章
JS操作css样式用法
查看>>
怎样使用 CCache 进行 cocos2d-x 编译加速
查看>>
hdu 1233 还是畅通project (克鲁斯卡尔裸题)
查看>>
Thymeleaf 3.0 专题
查看>>
POJ 1061 青蛙的约会(扩展欧几里得)
查看>>
【Web探索之旅】第三部分第二课:IP地址和域名
查看>>
fedora25 采用二进制包安装mysql5.5.49
查看>>
Apache+wsgi+flask部署
查看>>
HTML的表单form以及form内部标签
查看>>
Bootstrap辅助类
查看>>
spring cloud 学习(3) - feign入门
查看>>
【VBA】切换引用样式
查看>>
SqlSever2005 一千万条以上记录分页数据库优化经验总结【索引优化 + 代码优化】...
查看>>
批量修改服务为手动
查看>>
第三百六十八节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)用Django实现搜索的自动补全功能...
查看>>
服务器硬件基础
查看>>
Linux shell逐行读取文件的方法
查看>>
Python中赋值、浅拷贝与深拷贝
查看>>
UWP开发笔记——嵌套式页面的实现
查看>>
Spring下的@Inject、@Autowired、@Resource注解区别(转)
查看>>