Upstream fail over?
mitchua
nginx-forum at nginx.us
Sun Aug 2 20:10:12 MSD 2009
I finally got this working the way I wanted it. I ended up using error_page instead per Maxim's suggestion:
upstream varnishservers
{
server 10.1.1.1:8080; #CACHE1
}
upstream originservers
{
server 10.2.2.2:80; #WEB1
server 10.3.3.3:80; #WEB2
}
server
{
listen 8080;
server_name _;
server_name_in_redirect off;
location /
{
access_log off;
error_page 502 503 504 = @origin;
proxy_pass http://varnishservers;
proxy_set_header Host $host;
proxy_connect_timeout 1;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504 http_404;
proxy_intercept_errors on;
break;
}
location @origin
{
access_log off;
proxy_pass http://originservers;
proxy_set_header Host $host;
proxy_connect_timeout 4;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504 http_404;
proxy_intercept_errors on;
break;
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3296,4682#msg-4682
More information about the nginx
mailing list