Skip to content

Instantly share code, notes, and snippets.

@paramah
Last active December 25, 2015 20:58
Show Gist options
  • Save paramah/7038730 to your computer and use it in GitHub Desktop.
Save paramah/7038730 to your computer and use it in GitHub Desktop.
xmpp nginx
# Super
upstream xmpp {
server 10.0.0.10:5280;
server 10.0.0.11:5280;
server 10.0.0.12:5280;
}
map $cookie_vroute $sticky {
default xmpp;
v1 10.0.0.10:5280;
v2 10.0.0.11:5280;
v3 10.0.0.12:5280;
}
server {
listen 80;
server_name myxmpp.local;
location /xmpp {
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_connect_timeout 5;
proxy_buffering off;
proxy_pass http://$sticky$uri;
proxy_read_timeout 70;
keepalive_timeout 70;
send_timeout 70;
error_page 502 = @xmpp_fallback;
}
location @xmpp_fallback {
proxy_set_header Host $http_host;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_connect_timeout 5;
proxy_buffering off;
proxy_pass http://xmpp;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment