Werc Quick Setup for Debian Linux+Lighttpd

This setup is based on a netinstall of Debian stable (5.0.7 as of this writing). Just follow the instructions provided below and in five minutes you will have lighttpd installed and configured to use werc.rc as CGI serving up HTML.

I have provided the relevant portion of my shell history file, a diff of my lighttpd.conf and the output of uptime when I was done for reference.

I implore you to do all the relevant research and read all the relevant documentation pertaining to werc itself, Plan 9 from User Space, the rc shell, and markdown.

Acquire software

I am using Debian so I grab lighttpd and build-essential with the aptitude package manager. I chose lighttpd as my web server, but werc should work with any web server that supports the CGI interface. Some sample configuration files are provided in the werc docs. build-essential is a package in Debian that includes the main tools neccessary for compiling code on Debian. We basically just need GNU make to build Plan 9 mk(1).

aptitude install lighttpd build-essential
curl http://dl.suckless.org/tools/9base-6.tar.gz | tar xzf 
curl http://hg.cat-v.org/werc/archive/tip.tar.bz2 | tar xjf 

Build p9p

Next I build Plan 9 from User Space (shortened p9p or plan9port). Actually, I’m using 9base as a minimalist replacement for the full blown p9p. As previously mentioned, make builds mk(1) which is then used to build the rest of p9p.

cd 9base-6
make install clean

Move files/folders into place

A beautiful thing about werc is that it deals solely with flat files and directories. This makes it painless to set up, manage and configure.

mv ../werc-bec1802070f8/ /var/www/werc
cp -r /var/www/werc/sites/default.cat-v.org /var/www/werc/sites/your.domain.com
echo '# Hello World!' > /var/www/werc/sites/your.domain.com/index.md

Configure web server

I have chosen lighttpd as my web server because it is fairly simple and light. This is obviously debatable and you should follow the docs when configuring your own. Here is the diff of my current config against the one provided by the Debian package.

17d16
<             "mod_cgi",
169,175d167       
< $HTTP["host"] =~ "^your\.domain\.com$" {
<     index-file.names = ( )
<     server.error-handler-404 = "/werc.rc"
<     alias.url       += ( "/werc.rc" => "/var/www/werc/bin/werc.rc" ) # Here use the path to werc.rc in your system.      <     cgi.assign += ( ".rc" => "")
<     cgi.assign += ( ".rc" => "")
<     server.dir-listing = "disable"
< } 

To post a comment you need to login first.