いつもお世話になっております。
confファイルでページごとにbasic認証を設けたいのですがうまくいかずに投げ出したくなっております。
Nginx confファイル
1 server { 2 listen 80; 3 server_name www.hogehoge.example.co.jp; 4 root /var/www/git-deploy/; 5 6 #charset koi8-r; 7 index index.php index.html index.htm; 8 ~~~ 9 location /hogedir/hugahuga/ { 10 index index.php index.html index.htm; 11 if (-f $request_filename) { 12 expires 30d; 13 break; 14 } 15 if (!-e $request_filename) { 16 rewrite ^(.+)$ /hogedir/hugahuga/index.php?$1 last; 17 #rewrite ^(.+)$ /index.php?$1 last; 18 } 19 20 location /hogedir/hugahuga/Login/ { 21 auth_basic "Basic authentication"; 22 auth_basic_user_file /etc/nginx/dirAAA/.htpasswd; 23 } 24 location /hogedir/hugahuga/UserInfo/ { 25 auth_basic "Basic authentication"; 26 auth_basic_user_file /etc/nginx/dirBBB/.htpasswd; 27 } 28 }
ですが上記のやり方だとBasic認証は発動するのですが認証が通った後404エラーをはいてしまします。
憶測ですがlocationで指定しているURLをNginxがディレクトリのパスで解釈してCodeigniterを無視して読みに行っているのかなとも思うのですがよくわかりません。
何卒有識者様のお知恵を拝借できればと思います。
よろしくお願いします。
あなたの回答
tips
プレビュー