Posts tagged ‘lighttpd’

Book: Lighttpd

As I mentioned in the previous post I received an email pointing me towards a newly released book on lighttpd. Only one chapter is available free of charge so that and the table of contents is all I can comment on at this point.

Let’s start with the table of contents. To be honest I found it very disappointing, there were so many other chapters that I would have found much more interesting than chapter 10. Given that I’ve never really gotten into Apache to begin with I would much rather have read about advanced configuration (chapters 2 and 3), or CGI (chapters 3 and 11), or maybe most about securing lighttpd, both securing what it serves (through SSL, chapter 6) and by reducing privileges (chapter 8). Yes, for me personally they’ve chosen the least interesting chapter to make available free of charge ;-)

So, what do I think about chapter 10 then? Overall I’m happy with it. In a book like this, one that covers usage of a specific piece of software, I’m happy to find text that is clear and simple to understand. It isn’t very deep in concepts and details, but there are links to places where I can find out more if I need it. I’m not familiar enough with lighttpd to judge whether the details are correct, but I assume they are, and as I already mentioned it isn’t a complete reference, but offers links to where the reader can find more details. One thing that did upset me a little is the presence of rather lengthy pieces of Python scripts to aid in the converting some of the Apache configuration to lighttpd. Though I suppose they fit in I’d rather have seen them made available only online, with just the descriptions and usage in the book. I couldn’t help but feel they were there only to increase the page count.

Anyway, what I’ve seen so far makes me want to read the rest of the book. As I’ve made clear I’m not a serious user of lighttpd, but it is the web server I reach for first when I find myself needing one. I think this book will make me a more efficient user of lighttpd.

A first for me…

I’ve read quite a few articles about the changing landscape of marketing, how regular ads and old-style marketing is no longer trusted. I suppose companies have over-promised and under-delivered for too long. Instead PR firms are adding blogging into the mix, which probably means blogs will be ruined in the long run ;-) For now though blogs are still trusted, especially when it’s regular people who write about products.

So, why this post? Well, it seems the few posts I’ve made here on lighttpd seems to have attracted some minimal attention and I received an email regarding a new book on lighttpd, published by Packt publishing. This despite the fact that I am what can only be called a cursory user of lighttpd. It contained a link to a gratuitous chapter so I decided to play along and pubically comment on the chapter. If you don’t like this kind of thing then you should skip the next post.

Debian, lighttpd and MediaWiki

I just went through the exercise of setting up MediaWiki on a Debian Etch box, but instead of serving it using the common choice of Apache I wanted to use lighttpd. It seems the combination MediaWiki and Apache is well supported on Debian. There was even an install-time question whether I wanted the configuration files set up for me. Well, it’s boring to follow the common path, right?

It seems the combination MediaWiki and Apache is well supported on Debian. Luckily that doesn’t mean it’s difficult to serve it with lighttpd. Here’s how I configured things, and luckily it all seems to work just fine ;-)

Installation

First off, I installed mediawiki1.7, lighttpd, php5-cgi, and mysql-server. I made sure that aptitude only pulled in required packages and then I started un-choosing all Apache-related packages. By the time you get to installing MySQL you’ll be asked for a root password, that is if your debconf is set to ask medium-level questions.

Setting up MediaWiki

The Debian package for MediaWiki creates a site in /var/lib/mediawiki1.7 consisting mostly of symbolic links to the actual location of its files. I kept lighttpd’s default document root of /var/www and linked the two by creating a symbolic link /var/www/mw pointing to the MediaWiki site (/var/lib/mediawiki1.7).

Configuration of lighttpd

First enable FastCGI by linking /etc/lighttpd/conf-available/10-fastgi.conf into /etc/lighttpd/conf-enabled/. Then go in and change the bin-path to point to /usr/bin/php5-cgi. To prepare for the MediaWiki configuration, enable mod_rewrite in /etc/lighttpd/lighttpd.conf and finally create the file /etc/lighttpd/conf-enabled/20-mediawiki.conf with the following contents:

url.rewrite-once = (
    "^/$" => "/mw/index.php",
    "^/wiki/([^?]*)(?:\?(.*))?" => "/mw/index.php?title=$1&$2"
  )

Now it’s time to restart lighttpd.

Configuration of MediaWiki

Point a browser to http://your.server/mw/config/index.php to configure the site settings. When that’s done copy the file /var/lib/mediawiki1.7/config/LocalSettings.php one layer up.

That should be it! Enjoy!

darcsweb+lighttpd on Debian

I couldn’t find any information on how to set up darcsweb on lighttpd in general. I was a little disappointed to see that the darcsweb package on Debian only comes with apache and apache2 configurations, nothing for lighttpd. Since Debian is a little special sometimes when it comes to web servers—they like to add convenient configuration “frameworks”—I was afraid that using a “non-supported web server” might be a lot of work. How wrong I was :-)

First enable the CGI module for lighttpd:

# cd /etc/lightttpd/conf-enabled
# ln -s ../conf-evailable/10-cgi.conf

Then create a very short configuration file to enable darcsweb to find its images:

# cd 
# echo 'alias.url += ( "/darcsweb/" => "/usr/share/darcsweb/" )' > \
/etc/lighttpd/conf-available/50-darcsweb.conf

Then enable that “module” as well:

# cd /etc/lightttpd/conf-enabled
# ln -s ../conf-evailable/50-darcsweb.conf

Create your darcs repositories in /var/www/darcs/. I created a repo I called test.

The Debian default configuration of darcsweb will expose all repositories in /var/www/darcs/. This is quite probably not what I wanted so I commented out the auto class and added the following:

class test:
    reponame = 'test'
    repodesc = 'Silly little test repo'
    repodir = '/var/www/darcs/test'
    repourl = 'http://denobula/darcs/test/'
    repoencoding = 'latin1'

That’s it!

Minimal lighttpd configuration

This is the configuration I used to get lighttpd to serve up the results of AxMan.

server.document-root = "/home/magnusth/tmp/axman/www/"
server.port = 8080

index-file.names = ( "index.html" )

mimetype.assign = (
  ".html" => "text/html",
)