Last active
October 2, 2017 02:48
-
-
Save ncole458/f803ca7c3e40f6a9b77d92709440bb32 to your computer and use it in GitHub Desktop.
Full Django>Gunicorn>NGINX Config w/WebSockets
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
upstream app_server { | |
server 127.0.0.1:9000 fail_timeout=0; | |
} | |
upstream websocket { | |
server 127.0.0.1:8001 fail_timeout=0; | |
} | |
#server { | |
# listen 80; | |
# server_name api.url.com.au; | |
# rewrite ^/(.*) https://api.url.com.au/$1 permanent; | |
#} | |
server { | |
listen 80; | |
server_name api.url.com.au; | |
# SSL TO BE ENABLED ON GO LIVE | |
# listen 443 ssl spdy; | |
# client_max_body_size 4G; | |
# server_name api.url.com.au; | |
# ssl_certificate /root/user/api.url.com.au.chained.crt; | |
# ssl_certificate_key /root/user/api.url.com.au.key; | |
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
# ssl_prefer_server_ciphers on; | |
# ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL; | |
# keepalive_timeout 5; | |
# django static files etc | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location /static/ { | |
root /apps/django/django_projects/Project/ProjectAPI; | |
} | |
location / { | |
include proxy_params; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Protocol $scheme; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
} | |
location /websockets { | |
proxy_pass http://websocket; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment