Skip to content

Instantly share code, notes, and snippets.

@thraxil
Created November 16, 2015 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thraxil/bca3e9ceb20458a06fcb to your computer and use it in GitHub Desktop.
Save thraxil/bca3e9ceb20458a06fcb to your computer and use it in GitHub Desktop.
{% 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