Nginx 404 showing when I configured for a custom 404 page

Maxim Dounin mdounin at
Fri May 18 09:48:27 UTC 2012


On Thu, May 17, 2012 at 04:34:14PM -0700, Quintin Par wrote:

> Hi all,
> I have a 404 custom page set like this
>         error_page  404        = @errorpages;
>         error_page  500        = @errorpages;
>         location @errorpages {
>                     root /var/www/;
>                     internal;
>                     proxy_pass http://localhost:82;


>         }
> But every now and then I am hitting the nginx vanilla 404 pages, especially
> when hitting rate limiting.
> How do I close the gaps to ensure I am showing only the custom 404’s ?

Most likely you are see double errors with 404 being the last 
one.  By default nginx returns builtin error page in such cases, 
unless recursive_error_pages is set.  (And it's not really good 
idea to change the default unless you understand what are you 
doing and sure it won't create loops.)

I would recommend to

a) use static files for error pages;

b) make sure no limits are applied to error pages location.

Maxim Dounin

More information about the nginx mailing list