我有以下
location /admin { auth_pam "Secure Zone"; auth_pam_service_name "nginx"; if (-f $request_filename) { expires max; break; } if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") { rewrite ^(.*) /admin.php last; } }
如果我注释掉重写,我得到htpasswd框..它在那里我完全忽略它。 我需要所有的/ admin / * url来获取admin.php脚本,并且脚本处理路由。
location /admin { auth_pam "Secure Zone"; auth_pam_service_name "nginx"; try_files $uri $uri/ /admin.php; location ~* \\.(js|htc|ico|gif|jpg|png|css)$ { access_log off; expires max; } }