error_page directive, how does context affect error handling behavior?

Grégory Pakosz gpakosz at
Sun Feb 26 18:45:54 UTC 2012


I'm using nginx 1.1.14 on Debian Squeeze.

In /etc/nginx.conf I wrote:
error_page 404;

That error_page directive is written in the http context.

So far so good, when I visit and foo.txt
doesn't exist in root's folder, I'm getting redirected to as
per the 404 error handling.

However, if in my server context, inside /etc/sites-available/default, I
error_page 418;

Then 404 error handling from http's context doesn't work anymore. When I
visit I'm not redirected to as
before but I see nginx's default 404 error page "404 Not found".

here is my nginx.conf:
and my default site conf:

Is there something I overlooked about nginx's error_page directive?

Thank you in advance for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list