Nginx - Serve blank page on "Bad Gateway" error
Posted
by
TheLittleCheeseburger
on Server Fault
See other posts from Server Fault
or by TheLittleCheeseburger
Published on 2010-09-29T01:27:57Z
Indexed on
2011/02/25
23:27 UTC
Read the original article
Hit count: 279
Hello all.
I want to use Nginx as a simple reverse proxy, but if the server behind Nginx is down I just was to display a blank page. For some reason this configuration isn't displaying a blank page on error 502 and I can't figure out why.
Thanks for your help!
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
# multi_accept on;
}
http {
keepalive_timeout 65;
proxy_read_timeout 200;
upstream tornado {
server 127.0.0.1:8001;
}
server {
listen 80;
server_name www.something.com;
location / {
error_page 502 = @blank;
proxy_pass http://tornado;
}
location @blank {
index index.html;
root /web/blank;
}
}
}
© Server Fault or respective owner