How do I use a custom 503 error page with Nginx?

Posted by Michael Gorsuch on Server Fault See other posts from Server Fault or by Michael Gorsuch
Published on 2010-05-11T17:22:34Z Indexed on 2010/05/11 17:25 UTC
Read the original article Hit count: 170

Filed under:

Hi. I have implemented rate limiting with Nginx (which works excellently, by the way) and would like to display a custom 503 error page.

I have followed examples on the web without luck.

I am running a simple configuration that looks something like this:

listen x.x.x.x:80
server_name something.com
root /usr/local/www/something.com;
error_page 503 /503.html;

location / {
  limit_req zone=default burst=5 nodelay;
  proxy_pass http://mybackend;
}

The idea is that our rate limited users would be shown a special page explaining what was going on. The rate limiting is working, but the built-in 503 page is rendering.

Any ideas?

© Server Fault or respective owner

Related posts about nginx