Lighttpd mod_rewrite
I've migrated my teeny-weenie Xen web/mail server to Debian/etch. It hasn't even been rebooted (it would be a shame to spoil the uptime :-) ):
$ uprecords # Uptime | System Boot up ----------------------------+--------------------------------------------------- -> 1 198 days, 06:16:44 | Linux 2.6.16.13-xenU Thu Oct 12 10:12:51 2006 2 99 days, 19:25:00 | Linux 2.6.12-xenU Sun Oct 9 03:58:58 2005
It runs Lighttpd, a small and fast little webserver, popular in the Rails world. Lighttpd with PHP-fastcgi is probably faster than apache, and uses much less RAM.
With etch, I've finally been able to get mod_rewrite to work. So my Zapiro archive has nice URLs now :-)
Lighttpd has a very nice configuration style:
# No WWW
$HTTP["host"] =~ "^www\.((.+\.)?rivera\.za\.net)$" {
url.redirect = ( ".*" => "http://%1$1" )
}
# Add WWW:
$HTTP["host"] =~ "^((foobar|someclient)\.co\.za)$" {
url.redirect = ( ".*" => "http://www.%1$0" )
}
############################################
# PHP Apps:
$HTTP["host"] =~ "^(zapiro\.rivera\.za\.net)$" {
url.redirect = ( "^/\?/(.*)" => "http://%1/$1" )
url.rewrite-once = ( "^/(feed)$" => "/index.php?/$1",
"^/([0-9]+/[0-9]+/[0-9]+)$" => "/index.php?/$1" )
}
It's more logical than apache, but you have to watch out for rewrite->redirect->rewrite loops. So if you change to a clean URL syntax, you can't put in rewrites from index.php?/uglurl to /uglyurl because /uglyurl rewrites back to /index.php?/uglyurl, and you get a loop :-)