Skip to content

Instantly share code, notes, and snippets.

@idvoretskyi
Forked from eric-wu/nginx.conf
Last active August 29, 2015 14:07
Show Gist options
  • Save idvoretskyi/e17e944529adf650341a to your computer and use it in GitHub Desktop.
Save idvoretskyi/e17e944529adf650341a to your computer and use it in GitHub Desktop.
# This sets up a nginx reverse proxy behind a load balancer and in front of
# the Play web app. The setup is illustrated as the following:
#
# LB:80 ==> RP:80 ==> (Redirect to https)
# LB:443 ==> RP:8080 ==> Backend:9001
#
# LB -- Load Balancer
# RP -- Reverse Proxy
#
# IMPORTANT: Remove the line `include /etc/nginx/sites-enabled/*` from this config
#
http {
##
# Reverse proxy
##
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
upstream dashboard-backend {
server localhost:9001;
}
server {
listen 8080;
server_name dashboard.synapse.org;
location / {
proxy_pass http://dashboard-backend;
}
}
##
# Redirect http to https
##
server {
listen 80;
return 301 https://$host$request_uri;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment