Welcome! Log In Create A New Profile

Advanced

Best practice on FastCGI configuration to avoid ambiguous FCGI_PARAMS keys

csg
August 02, 2012 02:30AM
Most of the times when configuring a FastCGI application it is just
good enough to include the fastcgi.conf which ships with the Nginx
distribution. On the other hand sometimes it is required to just change
one or few of the definitions in that file, for example when the
application resided outside document root. Practically something like

include fastcgi.conf;
fastcgi_param DOCUMENT_ROOT /foo/bar;

worked for me so far (in combination with php-fpm(8)). While debugging
a different issue I also had a network sniffer running the traffic
between Nginx and the FastCGI application server, I found out that Nginx
takes that sort of configuration literally and transfers two
DOCUMENT_ROOT parameters, first with the setting given in fastcgi.conf
and then the one specified explicitly.

From theoretical point of view one can argue that this is a
configuration flaw, but from a practical point of view I wonder if it
wouldn't make sense for Nginx to allow override of FCGI_PARAMS keys and
just transfer the last definition. The FastCGI specification [1] is
pretty vague on ambiguous FCGI_PARAMS keys and the order of processing.
This basically passes the ball to the FastCGI application server to sort
out what would be "best", e.g. take the very first value definition of a
specific FCGI_PARAMS, the last one, role a dice, etc. This might lead to
the situation where the same Nginx configuration could trigger different
behavior dependent in which FastCGI application server would be used.

Again, I don't see this directly as Nginx's fault, the question is just
of this is desirable for the ease of system administration to keep
configurations compact and clear with still a well-defined behavior.
Reducation of network traffic between Nginx and the FastCGI application
would be another aspect.

Any other opinions on that?

-cs

[1] http://www.fastcgi.com/om_archive/kit/doc/fcgi-spec.html#S5.2

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

Best practice on FastCGI configuration to avoid ambiguous FCGI_PARAMS keys

csg August 02, 2012 02:30AM

Re: Best practice on FastCGI configuration to avoid ambiguous FCGI_PARAMS keys

Maxim Dounin August 02, 2012 06:02AM

Re: Best practice on FastCGI configuration to avoid ambiguous FCGI_PARAMS keys

csg August 02, 2012 11:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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