error_page directive, how does context affect error handling behavior?

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


Hello,

I'm using nginx 1.1.14 on Debian Squeeze.

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

That error_page directive is written in the http context.

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

However, if in my server context, inside /etc/sites-available/default, I
write:
error_page 418 http://nginx.org;

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

here is my nginx.conf: http://pastebin.com/5nffYFvK
and my default site conf: http://pastebin.com/CYcEFnwx

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

Thank you in advance for any help.
Gregory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120226/a5889dc4/attachment.html>


More information about the nginx mailing list