Skip to content

Instantly share code, notes, and snippets.

@tinnguyenz
Created January 3, 2012 17:26
Show Gist options
  • Save tinnguyenz/1555924 to your computer and use it in GitHub Desktop.
Save tinnguyenz/1555924 to your computer and use it in GitHub Desktop.
Django fastcgi on Nginx
worker_processes 2;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}
http {
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 4 2k;
request_pool_size 4k;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
ignore_invalid_headers on;
index index.html;
server {
server_name couponyo.local;
listen 443;
ssl on;
ssl_certificate /opt/server.crt;
ssl_certificate_key /opt/server.key;
keepalive_timeout 70;
root /home/tin/works/python/couponyo;
location /media {
root /home/tin/works/python/working/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/contrib/admin/media;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) {
access_log off;
expires 30d;
}
location / {
# host and port to fastcgi server
fastcgi_pass 127.0.0.1:8080;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param HTTPS on;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment