Auth basic and fast cgi rules with request matched by location

tom wang tomawng at
Mon Jul 30 20:16:37 MSD 2007


Is there a way for a request to match more than one
location statement? 

To be more clear, I have the following configuration

 server {
   # port to listen on. Can also be set to an IP:PORT
   listen       80;

   # sets the domain[s] that this vhost server
requests for

   # vhost specific access log
   access_log      /var/log/nginx/blah.access_log
   error_log       /var/log/nginx/blah.error_log info;

   root /site/www;
   index  index.html index.htm index.cgi;

   location ~* .cgi$ {
     satisfy_any on;
     include /usr/local/nginx/conf/perl.conf;


  location ~ ^/schedule {
      auth_basic            "Restricted";

   location ~ ^/doumei {
      auth_basic            "Restricted";

   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
     root   html;

Is it possible for one request (for example
/doumei/add.cgi) to match both the cgi directive and
the basic authentification rules described in location
~ ^/doumei ? 
I have a lot of cgi script that need to be protected
by basic authentification and I'm trying to find the
best way to configure this.


Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

More information about the nginx mailing list