您的位置 首页 linux 运维

nginx 1.16.0 编译安装模块 ngx_http_reqstat_module

Linux Nginx 监控——基础监控、主要指标、状态查看、nginx access log 分析_nginx有哪些监控指标-CSDN博客

最要用centos7.9( rocky linux 10 出问题)

 

1-下载nginx源码

wget http://nginx.org/download/nginx-1.16.0.tar.gz

 

解压

2.下载ngx_req_status_module 模块, 这是第三方模块需要添加

 wget https://github.com/zls0424/ngx_req_status/archive/master.zip -O ngx_req_status.zip
 

解压

进入nginx-1.16.0源码目录执行:

patch -p1 < ../ngx_req_status-master/write_filter-1.7.11.patch

编译:

./configure --prefix=/opt/nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--without-http_gzip_module \
--with-pcre \
--with-file-aio \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--add-module=/app/nginx1.16.0/ngx_req_status-master

 

报错: centos7.9 没问题( rocky linux 10 出问题)

我系统里有pcre2 ,但是还是失败

只能编译安装pcre(pcre2,)了,可以指定目录:(建议安装 pcre 8.45)

编译安装pcre-白眉大叔

 

然后:

 

./configure --prefix=/opt/nginx1.16.0 \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--without-http_gzip_module \
--with-pcre \
--with-file-aio \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--add-module=/app/nginx1.16.0/ngx_req_status-master

 

 

编译安装:

make && make install

 

然后启动nginx

cd /opt/nginx1.16.0/sbin
 ./nginx

 

配置:

vim nginx.conf
req_status_zone server_name $server_name 256k;
req_status_zone server_addr $server_addr 256k;
req_status_zone server_url  $server_name$uri 256k;
req_status server_name server_addr server_url;
server {
        listen 80;
        server_name localhost;
        location /req-status {
        req_status_show on;
        }
}
​

 

 

访问:

http://10.0.0.200/req-status

字段解释:

zone_name - 利用req_status_zone定义的分组标准。例如,按照服务器名称对请求进行分组后;
key -请求按分组标准分组后的分组标识(即组名)。例如按服务器名称分组时,组名可能是localhost;
max_active -该组的最大并发连接数;
max_bw - 该组的最大带宽;
traffic - 该组的总流量;
requests - 该组的总请求数;
active - 该组当前的并发连接数;
bandwidth - 该组当前带宽。

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章