uwsgi is a Python wsgi server which speaks a custom wire protocol upstream. uwsgi is configured through its command line interface and breaks many useful tuning parameters out into simple command line options.


Compiling uwsgi

Go to uwsgi's site and download the lastest stable source tarball.

On debian, you'll need build-essential and libxml2-dev:

# aptitude install build-essential libxml2-dev

Untar, then compile with make:

$ tar xvfz uwsgi-
$ cd uwsgi-
$ make

Uwsgi has no install make target, so just move the binary to /opt:

# mkdir -p /opt/uwsgi/uwsgi-
# mv uwsgi /opt/uwsgi/uwsgi-
# cd /opt/uwsgi
# ln -s uwsgi- current

Be sure to use the complete path to uwsgi, /opt/uwsgi/current/uwsgi unless you add /opt/uwsgi/current to your path.

Obtaining nginx 0.8 for uwsgi support

uwsgi configuration


run script


export PYTHON_EGG_CACHE=/tmp
export PLACES_CONFIG=$(pwd)/places_api.conf

exec 2>&1 
exec setuidgid www-data ${UWSGI} --ini uwsgi.ini


Note that uwsgi handles SIGTERM strangely, so the usual patterns of using svc -d and svc -t to take down and reload the uwsgi daemon will not work. Instead, send SIGINT:

# svc -i /etc/service/my-uwsgi-project # reloads project

# svc -d /etc/service/my-uwsgi-project # sets project to be "down," but will hang
# svc -i /etc/service/my-uwsgi-project # reloads project, leaving it down

Nginx configuration

  • upstream
  • uwsgi_params
  • uwsgi_pass