basic-authentication and php?

Igor Sysoev is at rambler-co.ru
Sat May 23 09:31:05 MSD 2009


On Fri, May 22, 2009 at 10:52:19PM +0100, Ian Hobson wrote:

> Igor, Jim, Michael
> 
> Many thanks to all your help.
> 
> That aspect of the site is working properly now in both IE and FireFox.
> 
> Tomorrow I will try to get my head round the nginx version of
>  
> RewriteRule ^/ppg/(email|print)/(quote|ack|amend)(\d+)\.pdf$ 
> /ppg/index.php?view=$2&act=$1&id=$3

The faster way (0.7.x):

location ^~ /ppg/ {
   auth_basic "Hello, Please login";
   auth_basic_user_file /var/www/site.com/passwords;

   location ~ ^/ppg/(email|print)/(quote|ack|amend)(\d+)\.pdf$ {
       fastcgi_pass    127.0.0.1:9000;

       fastcgi_param   SCRIPT_FILENAME  /path/to/php/ppg/index.php;
       fastcgi_param   QUERY_STRING     view=$2&act=$1&id=$3;

       # fastcgi_params0 must have no SCRIPT_FILENAME and QUERY_STRING
       include /etc/nginx/fastcgi_params0;
   }

   location ~ .\php$  {
       fastcgi_pass 127.0.0.1:9000;
       include /etc/nginx/fastcgi_params;
   }
}

The slower way:

location ^~ /ppg/ {
   auth_basic "Hello, Please login";
   auth_basic_user_file /var/www/site.com/passwords;

   rewrite  ^/ppg/(email|print)/(quote|ack|amend)(\d+)\.pdf$
            /ppg/index.php?view=$2&act=$1&id=$3
            last;

   location ~ .\php$  {
       fastcgi_pass 127.0.0.1:9000;
       include /etc/nginx/fastcgi_params;
   }
}


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list