Ubuntu + nginx + Laravel9の組み合わせで、
BASIC認証をサイト全体に設定しています。
/hogeディレクトリ配下のみBASIC認証の対象外とすべく、
下記のようにnginxのconfファイルを記述しています。
認証なしで/hoge配下のURLにアクセスすることはできるのですが、
同時にBASIC認証のダイアログが出てしまいます。
認証ダイアログが出なければ実現したい挙動となるのですが、
どこか問題があるでしょうか。
ご教授いただけますと幸いです。
server { server_name staging.hoge; auth_basic_user_file "/etc/nginx/.htpasswd"; root /var/www/html/hoge/public; index index.php index.html index.htm index.nginx-debian.html; server_name _; location / { root /var/www/html/hoge/public; index index.php; auth_basic "Basic Auth"; try_files $uri $uri/ /index.php?$query_string; } location /hoge { satisfy any; allow all; try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { root /var/www/html/hoge/public; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; }