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
configが継承されていないようです。したがって、Nginx は 404 を返します (/hg/repo1 および /hg/repo2 で)。
ヒントはありますか?