Lighttpd + MT 3.2 + PHP + Fast CGI
After battling with lighttpd and friends for a couple of hours, I finally have a very cool setup for this site.
I use the Moveable Type software to publish this articles. I modified the templates to publish each zone of the site in a separate HTML file. Then I use PHP to include them all in the final result. This allows me to generate the right hand-side column just once, as a index template, and include it on all the other articles.
So even if you go an see an old article, you'll still see my current right hand-side column.
In the past few weeks, though, Apache has been burning a lot of memory with all the traffic we've been getting on the several sites that are housed here. So I wanted to test another server, single threaded, and try to use FastCGI to reduce memory usage.
So after a PHP recompilation (use this page as an how-to) and some tweaking, I have a setup that works. I need to tune the other sites before moving to lighttpd but for now it looks and feels great.
My final configuration file looks something like this:
$HTTP["host"] == "www.simplicidade.org" {
server.indexfiles = ( "index.html" )
$HTTP["url"] =~ "^/notes/?(.+\.html)?$" {
fastcgi.debug = 0
fastcgi.server = (
"/" => ( (
"socket" => "/path/to/site/simplicidade.org/fcgi.socket",
"bin-path" => "/path/to/bin/php",
"min-procs" => 1,
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
) )
)
}
}
The $HTTP["url"] match makes sure that only files with the HTML extension will be processed by FastCGI, leaving all the images and CSS to lighttpd static file engine, which is very fast.
I also don't use the min-procs/max-procs settings for now. They seem broken to me because lighttd will always start max-procs no matter what I do. I think I'm missing something from the documentation.
Anyway, I'll move the other sites to similar setups and then I'll switch DNS to the new IP address with all this sites on lighttpd.

