Last active
December 26, 2015 14:19
-
-
Save lcruz/7164613 to your computer and use it in GitHub Desktop.
NGINX configuration with HTTPS and Gunicorn
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
upstream app_server { | |
server 127.0.0.1:8000; | |
} | |
server { | |
listen 443; | |
server_name <ip> <server>; | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_set_header X-Forwarded-Protocol $scheme | |
proxy_pass http://app_server; | |
} | |
location /static/ { | |
root /path/to/site/static-content; | |
access_log off; | |
expires max; | |
} | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/server.cl.chained.crt; | |
ssl_certificate_key /etc/nginx/ssl/server.cl.key; | |
} | |
server { | |
listen 80; | |
server_name 54.204.16.78 server.cl; | |
location / { | |
include /etc/nginx/proxy_params; | |
proxy_pass http://app_server; | |
} | |
location /static/ { | |
root /path/to/site/static-content; | |
access_log off; | |
expires max; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment