一、查看是否安装stub_status模块
1、查看www-nginx是否安装stub_status模块
#进入目录
cd /opt/nginx/www-nginx/sbin
#查看是否安装
./nginx -V 2>&1 | grep -o with-http_stub_status_module
##如果没安装重新安装编译
./configure --prefix=/opt/nginx/www-nginx --with-http_stub_status_module
make & make install
##启动
./nginx
##查看是否配置
curl http://192.168.1.41:20080/stub_status
2、查看www2-nginx是否安装stub_status模块
#进入目录
cd /opt/nginx/www-nginx/sbin
#查看是否安装
./nginx -V 2>&1 | grep -o with-http_stub_status_module
##如果没安装重新安装编译
./configure --prefix=/opt/nginx/www-nginx --with-http_stub_status_module
make & make install
##启动
./nginx
##查看是否配置
curl http://192.168.1.41:60080/stub_status
二、安装nginx_export
wget https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v1.3.0/nginx-prometheus-exporter_1.3.0_linux_amd64.tar.gz
tar -zxvf nginx-prometheus-exporter_1.3.0_linux_amd64.tar.gz -C /portal/monitor/nginx-prometheus-exporter
chown prometheus:prometheus -R /portal/monitor/
三、配置nginx的conf文件
server {
listen 20080;
listen [::]:20080;
server_name localhost;
er