Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following

    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;
            }
    }

If I comment out the rewrite I get the htpasswd box.. with it in there I ignores it completely. I need all my /admin/* urls to get the admin.php script and that script handles the routes.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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; } }

share|improve this answer

BROKEN!!! http://wiki.nginx.org/IfIsEvil

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.