Welcome! Log In Create A New Profile

Advanced

Re: Looking for help on fastcgi with different path

June 18, 2009 07:55AM
On Thu, Jun 18, 2009 at 01:41:43PM +0200, Artifex Maximus wrote:

> I have the following config file, excerpt:
>
> location / {
> root /home/;
> index index.php index.html index.htm;
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME /home$fastcgi_script_name;
> include fastcgi_params;
> }
> }
>
> location /x/ {
> alias /stat/;
> index index.php index.html index.htm;
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME /stat$fastcgi_script_name;
> include fastcgi_params;
> }
> }
>
> Because of different path I need to generate a different
> SCRIPT_FILENAME inside location /x/. But with this config file nginx
> looks for /stat/x/... file instead of /stat/... file. How should I
> solve this?

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;
}

> Another question. Is there any global fastcgi setup as lighttpd has? I
> mean that I give globally only the host, port, socket and other
> parameters (like SCRIPT_FILENAME) are generated by nginx.

There is no global fastcgi settings.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Looking for help on fastcgi with different path

Artifex Maximus June 18, 2009 07:41AM

Re: Looking for help on fastcgi with different path

Igor Sysoev June 18, 2009 07:55AM

Re: Looking for help on fastcgi with different path

Artifex Maximus June 18, 2009 08:50AM

Re: Looking for help on fastcgi with different path

morten July 29, 2009 10:25AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 317
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready