Skip to content

Instantly share code, notes, and snippets.

@schlunsen
Created November 24, 2013 21:29
Show Gist options
  • Save schlunsen/7632648 to your computer and use it in GitHub Desktop.
Save schlunsen/7632648 to your computer and use it in GitHub Desktop.
Nginx config for Django reverse proxy. Used in combination with gunicorn
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