0
我试图在Nginx中与proxy_pass
一起验证多个位置。 nginx的配置,那么以下内容:与Nginx代理一起使用多重身份验证
server {
listen 443;
server_name example.com;
location /hg/ {
rewrite ^/hg/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8001;
auth_basic "hg";
auth_basic_user_file hg.htpasswd;
location /hg/repo1/ {
auth_basic "hg-repo1";
auth_basic_user_file repo1.htpasswd;
}
location /hg/repo2/ {
auth_basic "hg-repo2";
auth_basic_user_file repo2.htpasswd;
}
}
}
认证工作正常,但代理被嵌套位置(repo1,repo2)打破。看来proxy_pass
配置没有被继承。所以,Nginx返回404(on/hg/repo1和/ hg/repo2)。
任何提示?