Deploying Snowy with Lighttpd


If you are running your own server, you may wish to deploy Snowy using Lighttpd using fastcgi. This guide is intended to help you do just that. I used the following guide:

Many thanks to SandyArmstrong and Jeff for helping me out in IRC!


You need to already have lighttpd and fastcgi installed and properly configured.

A few packages that are required

  • Lighttpd
  • flup
  • Django
  • Everything listed in the INSTALL file

I'm also assuming that since you run your own server, you've already tested your Snowy install using the Django test server ( runserver), followed the instructions in INSTALL, etc.


Fastcgi connects to the django app though a socket. Therefore, django needs to create the socket and then lighttpd's fastcgi needs to connect to the socket.

Save this file as The location does not matter much, in this example the location will be /home/http/snowy/

# Replace these three settings.

if [ -f $PIDFILE ]; then
    kill `cat -- $PIDFILE`
    rm -f -- $PIDFILE

exec /usr/bin/env - \
    PYTHONPATH="../python:.." \
   ./ runfcgi socket=$SOCKET pidfile=$PIDFILE

Issue proper permissions (ex: chmod 775

Add the following to your lighttpd.conf

  $HTTP["host"] =~ "" {
        accesslog.filename = "/var/log/lighttpd/access-snowy.log"     =       ""
        fastcgi.server = (
                "/snowy.fcgi" => (
                "main" => (
                "socket" => "/home/http/snowy/snowy.sock",
                "check-local" => "disable",

        alias.url = (
                "/site_media" => "/home/http/snowy/site_media/",
                "/media" => "/usr/lib/python2.6/site-packages/django/contrib/admin/media/",

        url.rewrite-once = (
                "^(/site_media.*)$" => "$1",
                "^(/media.*)$" => "$1",
                "^(/.*)$" => "/snowy.fcgi$1",


Make sure to change socket, site_media, media, and the other parameters accordingly.

This prevents urls from being written as Instead they will be written as

Restart or Reload lighttpd

Run as the web server user
Example (as root): su -c '/home/http/snowy/' http

Now go to the server and see if snowy loads: ex: http;//

If using SSL Remember to add to the file the following directive: URI_SCHEME = 'https'

You may want to add to /etc/rc.local or to a similar file so it starts and creates the socket when your server boots.
Ex: su -c '/home/http/snowy/' http &


Snowy 0.2

Projects/Snowy/Install/Lighttpd (last edited 2013-11-22 20:53:50 by WilliamJonMcCann)