Default error_page for multiple vhosts

Francis Daly francis at
Fri Feb 22 13:06:15 UTC 2013

On Fri, Feb 22, 2013 at 12:42:17PM +0100, Alexander Nestorov wrote:

Hi there,

> What I really ment to ask/say is: it will be really usefull to set
> some default rules that could be overriden later
> on each server{}.

That is already the case, within the limits of the nginx configuration
inheritance model (which is approximately: inheritance is by replacement,
or not at all) and valid directive contexts.

> Example:
> It would be really usefull (in my particular case) to set error_page
> to some absolute path so that all server{}
> get error_page automatically. Then, if my domain 42 needs a custom
> error_page I could just add the error_page
> to that server{} and it will get overriden.

>From the nginx configuration inheritance point of view, that already

Except that error_page take a uri, not a filename.

> This is (the way I see it) more elegant than re-generating server{}
> templates or doing ln -s.
> Think about http{} as a class and server{} as a derived class in any
> OOP language.

Yes, that is how it works already.

What you want is an alternative directive which is like error_page but
takes a filename.

Nothing to do with changing the inheritance model. And therefore
conceptually much simpler to get into the code base, if someone cares
enough to write it.

Francis Daly        francis at

More information about the nginx mailing list