编译安装 nginx的http_stub_status_module监控其运行状态
2023-09-11 14:15:05 时间
步骤:
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
相关文章
- KAFKA安装+配置详解+常用操作+监控
- 性能测试:监控web服务器--apache
- 有关OCS监控软件安装在windows上, 服务端显示乱码的问题
- Zabbix运维---监控
- Qt编写安防视频监控系统59-子模块3图文警情
- Qt编写安防视频监控系统40-onvif线程处理
- Qt编写安防视频监控系统30-GPS运动轨迹
- Qt编写安防视频监控系统6-面板开关
- Prometheus详解(九)——添加Prometheus监控标签
- 使用 Prometheus 监控 SAP ABAP 应用程序
- 【华为云技术分享】华为云文档数据库服务DDS监控告警全新优化
- Centos7 安装 smokeping 监控网络
- Centos下zabbix部署(二)agent安装并设置监控
- y72.第四章 Prometheus大厂监控体系及实战 -- prometheus server安装和node exporter安装(三)
- LabVIEW开发监控聚变实验脉冲电源
- 监控服务器配置(五)-----Redis_exporter安装配置
- 监控服务器配置(二)-----Grafana安装配置
- 使用redis_exporter和grafana进行redis监控
- 谈谈复杂事件处理与IT运维监控
- Prometheus安装部署及简单监控