Looking for help on fastcgi with different path

morten nginx-forum at nginx.us
Wed Jul 29 18:25:35 MSD 2009


Igor Sysoev Wrote:
-------------------------------------------------------
....
> 
> An "alias" is incorrectly inherited in nested
> locations.
> This is the reason why the nested locations are
> still not officially
> supported. Probably this will help:
> 
>   location  ~ ^/x/(.+\.php)$ {
>       alias  /stat/$1;
>       fastcgi_pass  127.0.0.1:9000;
>       fastcgi_index  index.php;
>       fastcgi_param  SCRIPT_FILENAME 
> $request_filename;
>       include  fastcgi_params;
>   }

Actually, it works perfectly well with both the fastcgi_pass and fastcgi_index parameters residing in the fastcgi_params file instead of the nginx.conf file. 
In fact, you can even put the SCRIPT_FILENAME inside the fastcgi_params file too, as long as you don't need to set the root on nested locations.


nginx.conf file:
location  ~ ^/x/(.+\.php)$ {
    alias  /stat/$1;
    fastcgi_param  SCRIPT_FILENAME $request_filename;
    include  fastcgi_params;
}

fastcgi_params:

....
fastcgi_pass  127.0.0.1:9000;
fastcgi_index  index.php;






 
> There is no global fastcgi settings.
But we're getting very close...

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






More information about the nginx mailing list