Skip to content

Instantly share code, notes, and snippets.

@mrvdb
Last active December 24, 2015 00:19
Show Gist options
  • Save mrvdb/6715728 to your computer and use it in GitHub Desktop.
Save mrvdb/6715728 to your computer and use it in GitHub Desktop.
nginx configuration for pump.io instance
# Define our upstream host(s)
# Upstream means in this case the port where the pump.io application runs
# as it is all on the same machine.
upstream pumpbackend {
server 127.0.0.1:9999 max_fails=3;
}
# Only select next_upstream host on error
proxy_next_upstream error;
# define $connection_upgrade to be either
# - 'upgrade' or
# - 'close' depending on $http_upgrade value
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Server block for pump.io
server {
# Include defaults for server
include /etc/nginx/include/server.conf;
# Make it trigger to qua.name
server_name qua.name;
# Mainly for image uploads
client_max_body_size 10M;
location / {
# Default proxy parameters (realip, x-forwarded-for etc.)
include /etc/nginx/include/proxy.conf;
# Configure in the protocol switch (needs fairly recent nginx)
proxy_http_version 1.1;
# Make sure the headers are passed on (normally they are not)
# using the map above
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# Go!
proxy_pass http://pumpbackend;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment