Lighttpd is a pretty nifty web server and a lot more lightweight than the likes of Apache, incorporating a number of similar features (webdav, rewrite, vhost, alias,compress) etc…

I just wanted to write a quick post on this as I didn’t find a satisfactory answer on the internet.  I had a small issue setting up lighttpd on debian.  One of the issues was that php pages were served up in Firefox as octet/application streams.  This was because the mime types were configured incorrectly in lighttpd.conf.  In order to fix this you have to define the mime types as follows:

http://redmine.lighttpd.net/wiki/lighttpd/Mimetype.assignDetails

It would seem that the config file provided with lighttpd is a cut down version, that then needs a lot of further work to get php based applications up and running.  Don’t get me wrong, this is a good thing because it teaches you the intracacies of web server configuration.

Essentially serving up php applications via Lighttpd requires fastcgi to be installed.

General Lighttpd Install
The following steps were required under Debian to install the latest version of Lighttpd from source:

  1. Install the Perl compatbile runtime expressions (pcre).  I got the latest version from: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.tar.gz
  2. Install php5-cgi, php5-cli, php5-common, php5-mysql packages using apt-get
  3. Install ruby-fcgi, I got this from
    http://www.moonwolf.com/ruby/archive/ruby-fcgi-0.8.7.tar.gz
  4. Install lighttpd from:
    http://www.lighttpd.net/download
  5. Configure and install using ./configure; make; make install

That’s about it, from there you need a simple startup script and some entries in the config file in /etc.

A word of advice, if you are migrating from Apache or similar web server then you can set Lighttpd on port 81 to test the installation and gradually move your applications over from there.