Welcome! Log In Create A New Profile

Advanced

Re: Possible to overwrite a fastcgi_param "later", once a location block has already been closed?

Francis Daly
July 09, 2013 05:50PM
On Tue, Jul 09, 2013 at 04:48:27PM -0400, Ben Johnson wrote:

Hi there,

> I am working with a server configuration that is partly outside of my
> control,

I suspect that that's not the intended use case for nginx. Whoever writes
the config file has the opportunity to configure it not to start.

> and have a need to overwrite a fastcgi_param "after" the
> directives that are outside of my control have already been included.

That sentence is possible; but not the one in your Subject: line.

> location @php {
> try_files $uri =404;
> include /etc/nginx/fastcgi_params;
> fastcgi_pass 127.0.0.1:9013;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> fastcgi_intercept_errors on;
> }
>
> # At this point, the fastcgi_param values have already been defined.
>
> # This is the include file that I am able to modify.
>
> include my-include.conf

That line must be within the "location @php" block, in order for it to
do what you want.

(Otherwise, you could try completely hijacking the config by using
something like

location ^~ / {
location ~ php$ {
# you control what goes here
}
# and what goes here
}

in my-include.conf, but that would be a good way to lose config privileges
on the server.)

> Is it possible for me to overwrite the values that are defined on the
> line "include /etc/nginx/fastcgi_params;" from within the included file
> that I can modify, "my-include.conf"?

Current nginx sends all fastcgi_params that are defined, in order; so
if you set the same one multiple times in the same context, all are sent.

Your fastcgi server probably only pays attention to the first one
received, or maybe to the last one received. Test to find out.

When you know which it is, put your "include" line before or after the
other "include" line, and see how it works.

Future nginx may stop sending all repeated fastcgi_params. If you change
fastcgi server, the one it pays attention to may change. So your testing
should be repeated after every upgrade.

f
--
Francis Daly francis@daoine.org

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

Possible to overwrite a fastcgi_param "later", once a location block has already been closed?

Ben Johnson July 09, 2013 04:50PM

Re: Possible to overwrite a fastcgi_param "later", once a location block has already been closed?

Francis Daly July 09, 2013 05:50PM

Re: Possible to overwrite a fastcgi_param "later", once a location block has already been closed?

Ben Johnson July 09, 2013 08:14PM

Re: Possible to overwrite a fastcgi_param "later", once a location block has already been closed?

Francis Daly July 10, 2013 05:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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