By hostname do you mean "http://backend" (upstream name) ? proxy_pass http://backend; If upstream is outside of location container it is allowed, but it still doesn't recognize "backup". Posted at Nginx Forum: http://forum.nginx.org/read.php?2,5960,5978#msg-5978