Rewrite problem

Hello,

location ~ /admin/

Above matches every admin folder on the domain but i just want to match
“/admin” on the url like http://domain.com/admin

Tried this location = /admin/

But that did not work. I`m suing this location to password protect.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,131021,131021#msg-131021

How to match every php file under the admin directory? Thanks. I dont
want to match admin folder globally on the domain.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,131021,131035#msg-131035

On Thu, Sep 16, 2010 at 12:37:01PM -0400, st1905 wrote:

Hello,

location ~ /admin/

Above matches every admin folder on the domain but i just want to match
“/admin” on the url like http://domain.com/admin

Tried this location = /admin/

But that did not work. I`m suing this location to password protect.

location = /admin


Igor S.
http://sysoev.ru/en/

Ok, solved this, just in case anyone needs the solution, here it is.

location /admin {
    auth_basic "Restricted";
    auth_basic_user_file /path/to/.htpasswd;
    location ~ \.php$ {
      include fastcgi.conf;
      fastcgi_pass my-backend;
    }
  }

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,131021,131044#msg-131044

On Thu, Sep 16, 2010 at 01:15:45PM -0400, st1905 wrote:

How to match every php file under the admin directory? Thanks. I dont
want to match admin folder globally on the domain.

location ~ ^/admin/.+.php$


Igor S.
http://sysoev.ru/en/

Igor S. Wrote:


Igor S.
http://sysoev.ru/en/


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx

That worked great, thank you.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,131021,131767#msg-131767

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs