Created
November 24, 2013 21:29
-
-
Save schlunsen/7632648 to your computer and use it in GitHub Desktop.
Nginx config for Django reverse proxy. Used in combination with gunicorn
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
server { | |
listen 80; | |
server_name example.com; | |
rewrite ^ https://$server_name$request_uri? permanent; | |
} | |
server { | |
server_name example.com | |
listen 0.0.0.0:443; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/server.crt; | |
ssl_certificate_key /etc/nginx/ssl/server.key; | |
access_log off; | |
location /static/ { | |
alias /home/example/app/versions/current/static/; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:8000; | |
proxy_set_header X-Forwarded-Host $server_name; | |
proxy_set_header X-Real-IP $remote_addr; | |
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment