Skip to content

Instantly share code, notes, and snippets.

@rahulkmr
Created March 24, 2013 14:26
Show Gist options
  • Save rahulkmr/5232161 to your computer and use it in GitHub Desktop.
Save rahulkmr/5232161 to your computer and use it in GitHub Desktop.
user root;
worker_processes 4;
# [ debug | info | notice | warn | error | crit ]
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
log_format download '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$http_range" "$sent_http_content_range"';
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 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;
keepalive_timeout 10 10;
reset_timedout_connection on;
upstream python_app {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name your.server.name
access_log /home/your_app/your_project/logs/nginx.access.log main;
error_log /home/your_app/your_project/logs/nginx.error.log info;
location ~* ^/static/.*$ {
root /home/your_app/your_project;
access_log /home/your_app/your_project/logs/nginx.static.log download;
}
location / {
proxy_pass http://python_app;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment