use different fastcgi backend in different folder

Igor Clark igor at pokelondon.com
Mon Sep 1 12:57:47 MSD 2008


This reminds me Igor, will it ever be possible (or is there some way  
it's possible now) to use matched patterns in regex location blocks?

E.g.

	location ~ ^(.*)/blah$ {
		fastcgi_param CUSTOM_VAR	$1;
	}

Cheers,
Igor

On 1 Sep 2008, at 06:00, Igor Sysoev wrote:

> On Mon, Sep 01, 2008 at 12:57:05AM +0200, Samuel Vogel wrote:
>
>> I am wondering how I can tell nginx to use a different fastcgi  
>> backend
>> for my phpmyadmin subfolder /pma.
>> This is what I did:
>>
>>       location ~ /pma/.+\.php$ {
>>               fastcgi_pass   127.0.0.1:9001;
>>       }
>>
>>       location ~ \.php$ {
>>               fastcgi_pass   127.0.0.1:9000;
>>       }
>>
>> The php backend on port 9001 is chrooted to the /pma folder. The  
>> problem
>> is, that $fastcgi_script_name now contains the /pma, so the php  
>> backend
>> can't find the right file.
>> How can I strip of the /pma from $fastcgi_script_name.
>>
>> I don't want to make another virtual host, since I don't want a  
>> seperate
>> port or subdomain just for phpmyadmin. Is a seperate vhost really the
>> only way to go?
>
> Try the following:
>
>        location ~ /pma/.+\.php$ {
>                rewrite  ^/pma(/.+)$  $1  break;
>
>                fastcgi_pass   127.0.0.1:9001;
>        }
>
>
> -- 
> Igor Sysoev
> http://sysoev.ru/en/
>

--
Igor Clark • POKE • 10 Redchurch Street • E2 7DD • +44 (0)20 7749 5355  
• www.pokelondon.com








More information about the nginx mailing list