Skip to content

Instantly share code, notes, and snippets.

@tnlin
Forked from yosemitebandit/yupyupnope.conf
Created March 21, 2017 10:05
Show Gist options
  • Save tnlin/285d8247628c7558797f5081fb80d172 to your computer and use it in GitHub Desktop.
Save tnlin/285d8247628c7558797f5081fb80d172 to your computer and use it in GitHub Desktop.
nginx config file for flask app (behind gunicorn) with ssl
server {
listen 80;
server_name www.yupyupnope.com;
rewrite ^/(.*) https://yupyupnope.com/$1 permanent;
}
server {
listen 80;
server_name yupyupnope.com;
rewrite ^/(.*) https://yupyupnope.com/$1 permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/certs/yupyupnope_com.crt;
ssl_certificate_key /etc/ssl/private/yupyupnope_com.key;
server_name yupyupnope.com;
access_log /home/matt/log/yupyupnope.com/access.log;
error_log /home/matt/log/yupyupnope.com/error.log;
location / {
# checks for static files; if not found, proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment