Custom forced 503 page does not work

Maxim Dounin mdounin at
Wed Jul 31 08:17:47 UTC 2013


On Wed, Jul 31, 2013 at 02:51:43AM -0400, skchopperguy wrote:

> Hi,
>  Nginx reads from top to bottom, just like you. In your example, you are
> returning 503 (an action) before instructing to use your custom error page.
> Just need to put your instructions first, then your so:
> error_page 500 502 503 504 /50x.html;
> location = /50x.html { root /usr/share/nginx/html; }
> location / { return 503; }

No, config directives order doesn't matter in general.  There are 
some exceptions (like rewrite module directives order, or order of 
locations with regular expressions), but the configuration in 
question is fine and has no problems with directives order.

Most likely, the problem was somewhere else (e.g. conflicting 
server{} block in the configuration, or original message author 
just forgot to reload the configuration after changes).

Maxim Dounin

More information about the nginx mailing list