mkdir -p /etc/nginx标签:nginxBasic,auth,认证,etc,Prometheus,basic,http,localhost From: https://blog.51cto.com/u_13236892/5885578
htpasswd -c /etc/nginx/.htpasswd admin
http {
server {
listen 12321;
location /prometheus {
auth_basic "Prometheus";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://localhost:9090/;
}
}
}
实际访问地址:http://localhost:12321/prometheus/metrics