Problem with inheriting fastcgi params
Maxim Dounin
mdounin at mdounin.ru
Sat Jun 6 06:03:40 MSD 2009
Hello!
On Fri, Jun 05, 2009 at 02:12:50PM -0700, Cliff Wells wrote:
> On Sat, 2009-06-06 at 00:17 +0400, Maxim Dounin wrote:
> > Hello!
> >
> > On Fri, Jun 05, 2009 at 12:36:36PM -0700, Michael Shadle wrote:
> >
> > > I have my normal fastcgi params in my main nginx.conf file, under server {}
> > >
> > > i.e.:
> > >
> > > fastcgi_param QUERY_STRING $query_string;
> > > fastcgi_param REQUEST_METHOD $request_method;
> > > fastcgi_param CONTENT_TYPE $content_type;
> > > fastcgi_param CONTENT_LENGTH $content_length;
> > > fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> > > fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> > > fastcgi_param REQUEST_URI $request_uri;
> > > fastcgi_param DOCUMENT_URI $document_uri;
> > > fastcgi_param DOCUMENT_ROOT $document_root;
> > > fastcgi_param SERVER_PROTOCOL $server_protocol;
> > > fastcgi_param GATEWAY_INTERFACE CGI/1.1;
> > > fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
> > > fastcgi_param REMOTE_ADDR $remote_addr;
> > > fastcgi_param REMOTE_PORT $remote_port;
> > > fastcgi_param SERVER_ADDR $server_addr;
> > > fastcgi_param SERVER_PORT $server_port;
> > > fastcgi_param SERVER_NAME $http_host;
> > > fastcgi_ignore_client_abort on;
> > > fastcgi_buffers 32 8k;
> > > fastcgi_index index.php;
> > >
> > >
> > > The problem is, whenever I want to add a variable (maybe override too,
> > > I forget) it seems to clear all the other ones out:
> > >
> > > location ~ \.php$ {
> > > fastcgi_pass 127.0.0.1:11003;
> > > fastcgi_param HTTPS on;
> > > }
> > >
> > > Now, only fastcgi_param HTTPS is set. no more SCRIPT_FILENAME so it's broken.
> >
> > It's expected and documented behaviour. All array-type settings
> > behave like this: they are inherited from upper levels only if
> > none defined at this particular level.
>
> Interesting. I was aware of the limitation Michael mentions, but
> didn't realize this was the particular mechanism. So I assume that
> "array-type" is indicated by the variable prefixes, i.e. fastcgi_*,
> proxy_*, etc?
Yes, it's generic mechanism. No, "array-type" isn't indicated by
anything. It's just includes any directives that may be repeated
and effectively append items to some array internally. This
includes access_log, error_log, fastcgi_param, proxy_set_header,
ssi_types (and other *_types as well), access rules (allow + deny)
and so on.
>From user-level point of view this behaviour is part of config
syntax. If it wasn't working this way - some other syntax would be
required to make it possible to clear inherited values.
>From developer point of view - it's just easy. Inheritance
involve just copy of array pointer from upper level if there are
no directives defined at particular level.
Maxim Dounin
>
> If you'll confirm this, I'll get it into the FAQ.
>
> Cliff
>
> --
> http://www.google.com/search?q=vonage+sucks
>
>
More information about the nginx
mailing list