Note: the Lighttpd compilation and installation instructions are no longer supported and are no longer updated. I’ve left them here purely as a reference for others to learn and use.

Lighttpd is a good alternative to Apache if you are looking for improved performance from your web-server. If you want to find more about the benefits of using Lighttpd over Apache please use Google. I consider it a good alternative but don’t want to get caught in a religious war. I just choose to provide this installation manual for people who wanted an alternative to Apache.

Note: If you haven’t installed Postfix using my instructions you are lacking the PCRE library, look at this page on how to install it.

Installing Lighttpd is easy, the difficult part is configuring it for proper use. Download the source from the site. Extract the archive and run the following commands:


You should see a list appear like:

mod_rewrite : enabled
mod_redirect : enabled
mod_ssi : enabled
mod_cgi : enabled
mod_fastcgi : enabled
mod_proxy : enabled

Make sure that mod_fastcgi is enabled or you won’t get PHP working when you’ve got Lighttpd installed.

sudo make install

This does all the work of compiling and installing and if you did’t get any errors you’ll be fine.

Next up quick configuring the server for it’s first time testing.

Copy the config file from the documentation folder to /etc/lighttpd/ sing the command:

sudo cp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf

Then edit the file /etc/lighttpd/lighttpd.conf.

Uncomment the following lines:

Change the following lines to match your environment:

server.document-root = “/Library/WebServer/Documents/”
server.errorlog = “/var/log/lighttpd/error.log”
accesslog.filename = “/var/log/lighttpd/access.log”
server.port = 80
fastcgi.server = ( “.php” =>
  ( “localhost” =>
      “socket” => “/tmp/php-fastcgi.socket”,
      “bin-path” => “/usr/local/php5x/bin/php-cgi”

Please note the different directory for the php 5 installation as we need to compile a different version of PHP to be able to use it with Lighttpd. I wan’t to keep an Apache version running for testing as well.

Create the directory /var/log/lighttpd/ using the command:

sudo mkdir /var/log/lighttpd

To test the config and to see if it all works you could start it using:

sudo /usr/local/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

Make sure Apache isn’t running, and if it is you can also use a different portnumber for Lighttpd. Change the line:

server.port = 81

And point your browser to http://localhost:81