use different fastcgi backend in different folder

Chris Savery chrissavery at gmail.com
Mon Sep 1 19:00:59 MSD 2008


I'm not sure how familiar you are with regex but just in case and if 
perhaps others are reading and it helps,

location ~ /pma/.+\.php$

~ means use regex to match the location
it starts by matching /pma/  and then .+ means one or more of any char
$ means the pattern has to end with .php
and the \. just escapes the . so it isn't  any char like above
this one has no brackets () so it doesn't capture any data

next,

rewrite  ^/pma(/.+)$  $1  break;

the ^ means matching from the start of line
the brackets () mean capture what matches inside them
in this case capture / and one ore more of any char
since the capture ends up against the $ that means capture all til the 
end of line
the $1 will contain  whatever was captured in the part above
and break means stop looking if this matches

rewrite means to match the first expression and rewrite as second expression
so here since the second part is simply $1 it means whatever is captured 
by the brackets will be the entire result of the rewrite
hence, here it is  "/ plus anything after" but drops the part not in the 
capture

hope that helps... just looking to give back a wee little to the list.

Chris :)




Samuel Vogel wrote:
> Igor Sysoev schrieb:
>> Try the following:
>>
>>         location ~ /pma/.+\.php$ {
>>                 rewrite  ^/pma(/.+)$  $1  break;
>>
>>                 fastcgi_pass   127.0.0.1:9001;
>>         }
> Thanks, this works!
> Even thou it works now, maybe somebody with some spare time could 
> explain to me what this actually does.
> I couldn't explain it to myself just with looking at the docs!
>
> Thanks,
> Samy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080901/85bc2e1f/attachment.html>


More information about the nginx mailing list