This tutorial is very simple, anyone with basic understanding of linux should be able to get it up and running. (this blog and everything else on is running on this configuration)

Side note: If you don't want to compile nginx and/or want a more stable solution consider gunicorn.

  1. Download nginx and mod_wsgi from the web and extract them
    tar xvzf nginx-0.8.53.tar.gz 6975f0ec7eeb.gz
  2. Make sure there are folders nginx-0.8.53 and mod_wsgi
  3. Install nginx (you will need gcc, libssl-dev and libpcre3-dev packages installed, you can just apt-get install them)
    cd nginx-0.8.53
    ./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --add-module=../mod_wsgi/ --with-debug
    sudo make install
    cd ..
  4. Install mod_wsgi
    cd mod_wsgi
    sudo python install --sbin-path=/usr/sbin --conf-path=/etc/nginx
    cd ..
  5. Configure nginx Go to /etc/nginx/ and create a directory sites or something like that for per virtual server configs and then edit your nginx.conf to something like that:
    user    www-data;
    worker_processes  1;
    events {
        worker_connections  1024;
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        #tcp_nopush     on;
        #keepalive_timeout  0;
        keepalive_timeout  65;
        tcp_nodelay        on;
        #gzip  on;
        wsgi_python_optimize 0;
        #wsgi_python_executable /usr/bin/python;
        #wsgi_python_home /usr/;
        wsgi_enable_subinterpreters on;
        include /etc/nginx/sites/*;
  6. If you need php, follow this few simple steps to get php-cgi up and running (skip "Install nginx" and test):
  7. Now all that is left are per-site configurations. For every site create a file in /etc/nginx/sites/ and paste something like that in it:

Django or other wsgi (you'll need django.wsgi file from here

server {
    listen       80;
    server_name; #change this
    location /media/ {
        root   /path/to/django/project/; #change this; without media at the end
    location / {
        wsgi_pass /path/to/django/project/django.wsgi; #change this
        include wsgi_vars;
        wsgi_pass_authorization off;
        wsgi_script_reloading on;
        wsgi_use_main_interpreter on;
server {
    listen 80;
    server_name; #change this
    root /path/to/wordpress/; #change this
    index index.php;
    try_files $uri $uri/ /index.php?q=$uri&$args;
    location ~ .php$ {
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

Other PHP: Same as wordpress, just delete the try_files if you don't want it (it redirects everything that doesn't exist to index).