Config variable inheritance: docs and rules

Hi all -

http://www.ruby-forum.com/topic/188742 seems to contain some
information I’ve not found explicitly stated anywhere else: that
config variable inheritance is an all or nothing mechanism. Have I
missed some docs somewhere?

Following on from this, I’d like to understand if there’s anything I
can reliably determine from a variable’s name about the impact that
defining it will have on other variables inheritance.

Can I, for instance, assume that defining an xyx_ prefixed variable in
a sub-scope will affect only the inheritance of other xyz_ prefixed
variables? Or can there be inheritance side-effects between, say $abc
and $def that I can’t possibly determine without documentation or
trial and error?

Equally, can I assume that all xyz_ prefixed variables will have
their inheritance affected by the sub-scope definition of any other
xyz_ prefixed variable? Or are there examples where defining $xyz_foo
does not invalidate the inheritance of $xyz_bar ?

Thanks,
Jonathan

Jonathan M.
London, Oxford, UK
http://www.jpluscplusm.com/contact.html

On Tue, Apr 03, 2012 at 02:13:57PM +0100, Jonathan M. wrote:

Hi there,

http://www.ruby-forum.com/topic/188742 seems to contain some
information I’ve not found explicitly stated anywhere else: that
config variable inheritance is an all or nothing mechanism. Have I
missed some docs somewhere?

That thread refers to configuration directives, not variables.

The difference might not matter, but for clarity it’s worth making sure
that we all understand the same thing.

In the above thread, the (wrong) expectation was that “fastcgi_param”
at one level would add to “fastcgi_param” from an enclosing level. In
fact, nginx doesn’t add between levels.

That is how nginx configuration works.

Each request is handled by exactly one location.

Only the configuration in that location, and inherited into that
location,
matters. Inheritance is global > http > server > location.

If a directive is used in that location, it overrides any
might-have-been-inherited values for that directive.

This is as true for single-valued directives like “root” as it is for
multi-valued directives like “fastcgi_param”.

Whether a particular directive can be inherited depends on the module
that processes it – which means “depends on the documentation”. But if
it can be inherited, it should follow the above rules. (Or it’s a
bug.)

The rest of your mail talks specifically about defining variables;
I’m talking about directives. Someone else may be able to explain the
variable rules; if you do mean “directives”, then the above should make
it clear what the answer in each case is.

There are some subtleties about what exactly is “a request”; and what
locations are involved when “if” is used; and how nested locations work.

But for trying to find what configuration applies to a particular
incoming http request, the “inherit or replace, but never add” rule
makes it straightforward to understand.

f

Francis D. [email protected]

On 3 April 2012 16:52, Francis D. [email protected] wrote:

The difference might not matter, but for clarity it’s worth making sure
that we all understand the same thing.

You’re absolutely correct; I’m referring to config directives, but was
thinking too hard about the question to notice I’d mixed my
terminologies. I’ll correct it, and resend the email in a new thread
for list archive niceness. It’d be great if you could cherry pick the
stuff you feel is relevant from your reply and resend it. If only for
those who come after … :slight_smile:

Jonathan

Jonathan M.
London, Oxford, UK
http://www.jpluscplusm.com/contact.html