Welcome! Log In Create A New Profile

Advanced

What's fastcgi_param scope

Jakub Zalas
March 24, 2011 04:14AM
Hi,

I'm experiencing odd behavior of fastcgi_param.

Based on the URL I'd like to pass additional parameters to PHP.

For example:

location ~ "^/foo/bar$" {
# this is not passed to fastcgi and not acesible via $_SERVER
fastcgi_param _ROUTING__route foo;
fastcgi_index app.php;
rewrite ^(.*) /app.php last;
}

# standard PHP stuff
location ~ \.php {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.*)") {
set $script $1;
set $path_info $2;
}
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/$host/web$script;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_NAME $script;
}

I also tried nesting location but the result is the same.
fastcgi_param defined in nested location block is not passed to PHP.

Could anyone explain me why it works this way?


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

What's fastcgi_param scope

Jakub Zalas March 24, 2011 04:14AM

Re: What's fastcgi_param scope

Maxim Dounin March 24, 2011 05:26AM

Re: What's fastcgi_param scope

Jakub Zalas March 24, 2011 06:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
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