Skip to content

Instantly share code, notes, and snippets.

@rudyryk
Last active December 30, 2015 08:29
Show Gist options
  • Save rudyryk/7802701 to your computer and use it in GitHub Desktop.
Save rudyryk/7802701 to your computer and use it in GitHub Desktop.
Nginx config sample: Django + FastCGI, e.g. Gunicorn
upstream app_server {
# Gunicorn or runfcgi-powered Django server
server 127.0.0.1:8000 fail_timeout=0;
}
server {
server_name server.name;
listen 443 ssl;
client_max_body_size 4G;
keepalive_timeout 5;
access_log /var/log/nginx/server.access.log;
ssl_certificate /home/aily/ssl/eily.chained.crt;
ssl_certificate_key /home/aily/ssl/eily.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS +RC4 RC4";
location ~ /(static|media)/.* {
root /home/www/htdocs;
}
location ~ ^/(favicon.ico|favicon.png|robots.txt)$ {
root /home/www/htdocs/static;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# see Django settings.SECURE_PROXY_SSL_HEADER
proxy_redirect off;
proxy_pass http://app_server;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment