Last active
May 6, 2016 16:14
-
-
Save jmoberly/b15a677c2a39eedf94f1e06efa1facd3 to your computer and use it in GitHub Desktop.
Simple reverse proxy config for AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $http_x_forwarded_proto $real_scheme { | |
default $http_x_forwarded_proto; | |
'' $scheme; | |
} | |
server { | |
listen 80; | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/certs/server.crt; | |
ssl_certificate_key /etc/nginx/private/server.key; | |
ssl_client_certificate /etc/nginx/certs/ca-certificates.crt; | |
ssl_verify_depth 1; | |
ssl_verify_client off; | |
resolver 169.254.169.253 valid=30s; | |
set $upstream_endpoint https://your-server; | |
location / { | |
proxy_pass $upstream_endpoint; | |
# HTTP 1.1 support | |
proxy_http_version 1.1; | |
proxy_set_header Host $http_host; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Host $http_host; | |
proxy_set_header X-Forwarded-Server $http_host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $real_scheme; | |
proxy_set_header X-Forwarded-URI $request_uri; | |
proxy_redirect off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment