custom 502 error page is ignored

Maxim Dounin mdounin at
Mon Nov 26 08:36:24 UTC 2012


On Sun, Nov 25, 2012 at 09:52:43AM -0500, gus0253 wrote:

> Dear all,
> I'm currently wondering why nginx ignores my custom 502 Bad Gateway page and
> instead serves the internal 502 error page.
> I'm using nginx version 1.2.4 and php-fpm 5.4.8
> The behaivior occures every time and is reproducible:
> If I stop php-fpm and request an existing php file my custom 502 error page
> is shown, so everything is fine.
> But if I request a non existing php file nginx shows me the nginx internal
> 502 error page.
> I don't know why my custom 502 error page is ignored, because it's a static
> html file.
> Do you have any tipps for me?


The 502 error happens while processing 404 error, and by default 
nginx won't do another error_page redirection after first one.  If 
you really want nginx to handle multiple error_page redirections, 
use the "recursive_error_pages" directive, see here:

You should be careful to avoid loops though.

Maxim Dounin

More information about the nginx mailing list