Skip to content

Instantly share code, notes, and snippets.

@ranjanashish
Created June 2, 2018 03:32
Show Gist options
  • Save ranjanashish/08a75aecae7bf1ac5312f43b31557a3a to your computer and use it in GitHub Desktop.
Save ranjanashish/08a75aecae7bf1ac5312f43b31557a3a to your computer and use it in GitHub Desktop.
nginx configuration for python projects
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_types application/javascript
application/json
text/css;
gzip_proxied any;
gzip_min_length 10240;
server {
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass unix:///path/to/uwsgi/uwsgi.sock;
# reference: https://stackoverflow.com/a/25573359/1240172
uwsgi_read_timeout 120s;
uwsgi_send_timeout 120s;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment