Config directive inheritance: docs and rules (was: Config variable inheritance)

Francis Daly francis at
Wed Apr 4 12:40:40 UTC 2012

On Tue, Apr 03, 2012 at 06:20:13PM +0100, Jonathan Matthews wrote:

Hi there,

> seems to contain some
> information I've not found explicitly stated anywhere else: that
> config directive inheritance is an all or nothing mechanism. Have I
> missed some docs somewhere?

That refers to inheritance of a *single* directive.

> Following on from this, I'd like to understand if there's anything I
> can reliably determine from a directive's name about the impact that
> defining it will have on *other* directives' inheritability.

Yes: it will have no impact on other directives.

> Can I, for instance, assume that defining an xyx_ prefixed directive in
> a sub-scope will affect *only* the inheritance of other xyz_ prefixed
> directives?

No. It will affect no other xyz_ prefixed directives.

It may make a difference to the *applicability* of other directives --
for example, if fastcgi_pass is not set, then it doesn't really matter
whether fastcgi_param is inherited or not, because it's not going to be
used. But fastcgi_pass does not affect whether fastcgi_param is inherited.

> Or can there be inheritance side-effects between, say,
> directive "abc" and "def" that I can't possibly determine without
> documentation or trial and error?

No, it will have no impact on other directives.

> Equally, can I assume that *all* xyz_ prefixed directives will have
> their inheritance affected by the sub-scope definition of any *other*
> xyz_ prefixed directive?

No: it will have no impact on other directives.

> Or are there examples where defining
> "xyz_foo" does *not* impact the inheritance of "xyz_bar"?

Yes: every example.

> I'm thinking specifically of proxy_* directives, whereas the thread I
> link to above is talking about multiple fastcgi_param directives.

Using a directive sets the value of that directive. It does not set the
value of different directives.

"Not using" a directive means the value of that directive is either
unset/default, or is the same value as the upper level.

> Here, I'm interested in how, say, proxy_set_header affects the
> inheritance of higher scope's proxy_pass directive - i.e. where the
> prefix matches but they're *not* the same directive.

No impact at all.

> Does nginx (core)
> derive or imply anything relating to the name-spacing of directives
> before (in my example) the proxy module sees the config, or is it
> entirely down to how each module implements the configuration
> aggregation/inheritance?

It's entirely down to how each module implements it. But if a module
implements inheritance of a directive as something other than "replace"
or "no inheritance", then that should probably be considered a bug.

Francis Daly        francis at

More information about the nginx mailing list