Skip to content

Instantly share code, notes, and snippets.

@jeremyjbowers
Created December 31, 2012 01:22
Show Gist options
  • Save jeremyjbowers/4416641 to your computer and use it in GitHub Desktop.
Save jeremyjbowers/4416641 to your computer and use it in GitHub Desktop.
A standard Nginx configuration for a uWSGI/Python application.
worker_processes 2; # sets two workers. might need 4 in a very high-traffic environment.
user www-data; # user to run nginx as.
pid /var/run/nginx.pid; # you'll have to create this pidfile or else things won't work.
events {
worker_connections 1024; # connections each worker can take.
use epoll; # epoll is vastly superior to other alternatives.
}
http {
# a bunch of basic stuff.
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off; # not logging access.
sendfile on;
keepalive_timeout 65;
tcp_nopush on;
tcp_nodelay on;
proxy_next_upstream error;
# set up the web server.
server {
listen 80; # serving on port 80 (e.g., http)
server_name server.domain.org; # your domain name. required for any virtual domains.
client_max_body_size 50M;
root /var/www;
location / { # this will match all requests. you can segment here by regex as well.
uwsgi_pass 127.0.0.1:9000; # pass to uwsgi on localhost and port 9000. uwsgi should be listening here.
include /etc/nginx/uwsgi_params; # make sure this matches your uwsgi_params location.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment