Created
November 16, 2015 16:13
-
-
Save thraxil/bca3e9ceb20458a06fcb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{% set app='example' %} | |
upstream {{app}} { | |
{% if pillar.role == 'staging' %} | |
server {{app}}.stage.ccnmtl.columbia.edu.s3-website-us-east-1.amazonaws.com; | |
{% else %} | |
server {{app}}.ccnmtl.columbia.edu.s3-website-us-east-1.amazonaws.com; | |
{% endif %} | |
} | |
server { | |
listen 80; | |
{% if pillar.role == 'staging' %} | |
server_name {{app}}.stage.ccnmtl.columbia.edu; | |
{% else %} | |
server_name {{app}}.ccnmtl.columbia.edu; | |
{% endif %} | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/ssl/ccnmtl-wildcard.pem; | |
ssl_certificate_key /etc/nginx/ssl/ccnmtl-wildcard.key; | |
{% if pillar.role == 'staging' %} | |
server_name {{app}}.stage.ccnmtl.columbia.edu; | |
{% else %} | |
server_name {{app}.ccnmtl.columbia.edu; | |
{% endif %} | |
access_log /var/log/nginx/{{app}}.access.log timed_combined; | |
if ($http_transfer_encoding ~* chunked) { | |
return 444; | |
} | |
location / { | |
proxy_pass http://{{app}}; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Protocol $scheme; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment