Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created September 29, 2011 23:37
Show Gist options
  • Select an option

  • Save yosemitebandit/1252240 to your computer and use it in GitHub Desktop.

Select an option

Save yosemitebandit/1252240 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;
}
}
@ar-anvd

ar-anvd commented Sep 17, 2015

Copy link
Copy Markdown

thanks, this is helpful to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment