我有一个简单的配置:
http {
server {
listen 8081;
server_name mynginx.local;
location /prom {
auth_basic "Access to Prometheus server";
auth_basic_user_file /etc/nginx/.htpassw;
proxy_pass http://192.168.1.192:9090/;
access_log off;
}
}
输入用户名和密码后,此配置不起作用,在日志中我看到以下内容:
*10 open() "/etc/nginx/html/graph" failed (2: No such file or directory), client: 192.168.1.3, server: mynginx.local, request: "GET /graph HTTP/1.1", host: "mynginx.local:8081"
但!如果我在配置文件中将此行位置 /prom 更改为此位置 / - 一切正常!
有人可以问我为什么吗?