Posts tagged ‘lighttpd’

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",
)