mercurial under fastcgi on lighttpd

Finally got mercurial to get served to the web using fastcgi under lighttpd. It took me about a full day to get it working, so I’d like to explain what I did so that someone else doesn’t struggle as long as I did.

This is just a really brief note: you should already be familiar with lighttpd configurations, as well as mercurial configuration.

I was interested in getting push/pull to work over http, so I grabbed version 0.9.3 of mecurial. Next, I set up the directory structure I wanted. In the place where I want the fastcgi script to run, I used a very simple script:

from mercurial.hgweb import hgwebdir_mod
from flup.server.fcgi import WSGIServer

from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication

configFile = '/opt/www/fastcgi/changes/hgweb.conf'

def make_web_app():
    return hgwebdir(configFile)
# evidently wsgiapplication expects a callable, not an object.
app = wsgiapplication(make_web_app)


I was able to get the page to render using a typical fastcgi setup in lighttpd, however with every request, I was seeing this exception in the error log. Some debugging in IRC was fruitful, once I was able to ask the right questions. I was shown a fix to the headers values must be str error, and so I manually edited it myself. I’m sure I’ll be kicking myself eventually when this comes back to bite me later. For, now I’m happy that the basic configuration seems to be running and working.

I was also just shown a script to run hgwebdir over fastcgi. Too late for that to help me now, but maybe it’ll help someone else.



  1. Posted July 19, 2007 at 7:14 am | Permalink

    I’ve written a reference page that includes what I had to do to get FastCGI working with Apache2 on Debian.

    I put your name as Ben West, but I can’t tell if that’s you or not.

  2. Posted August 2, 2007 at 7:52 pm | Permalink


    That’s great. Thanks.

    You got my name correct. :-).


  3. Posted October 15, 2013 at 1:42 am | Permalink

    seiko 陸上

Post a Comment

Required fields are marked *

%d bloggers like this: