Nginx监控模块with-http_stub_status_module简易配置

系统版本如下:

[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

加入模块,进行编译安装:

[root@localhost nginx-1.15.5]# ./configure --with-http_stub_status_module
[root@localhost nginx-1.15.5]# make && make install

检查模块加载情况:

[root@localhost nginx-1.15.5]#  nginx -V
nginx version: nginx/1.15.5
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
configure arguments: --with-http_stub_status_module

修改配置文件,添加以下内容:

[root@localhost nginx-1.15.5]# vim /usr/local/nginx/conf/nginx.conf
···
server {
···
        location ~ /status{
        stub_status on;
        access_log off;
       }
···
}
···

检测配置文件情况:

[root@localhost nginx-1.15.5]# 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-1.15.5]# nginx -s stop
[root@localhost nginx-1.15.5]# nginx 

浏览器打开:
http://192.168.1.117/status
显示:
Active connections: 1
server accepts handled requests
1 1 8
Reading: 0 Writing: 1 Waiting: 0

nginx-1.png

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容