Lighttpd, Rails and Tracks

· ruby and Rails ·

[Posted to both here and on Tracks]

Jason, of TextDrive fame, has been singing the praises of lighttpd recently. In my experience, when Jason sings about something techie, it's worth listening.

A week or so ago, the Apache installation I use to test Tracks locally abruptly stopped working. I'm pretty sure that I just messed something up in my httpd.conf, but my motivation to go through it, find the problem and fix it was seriously lacking. So given all the great press that lighttpd has been getting, I thought I'd have a go at installing it on my machine last night.

It wasn't a very difficult process, but I ended up having to try to compile it a couple of times. The first time, I neglected to notice the part of the instructions here that said you needed pcre installed. Then I came up against a maddening error during make that I couldn't fix until I came upon this excellent tutorial by Johan on installing on OS X. He found the same error as me, but had made a patch to fix the problem. Bingo"

Getting a working lighttpd.conf file was the next hurdle, but after some guidance here and a dash of trial and error, I managed to get Tracks running stably and beautifully on lighttpd. And fast. Boy, is lighttpd fast. I always found Apache to be really sluggish on my machine, but lighttpd running FCGI is really nippy and very economical on system resources.

So (as much for the fact that I'll probably forget what I did as anything else), here's my lighttpd.conf, set up to run a localhost install of Tracks on port 3000. At some point this weekend, I'll try setting it up for an externally-accessible configuration. The re-write rules were probably the hardest thing to sort out, but with the the advent of Routing in Rails which will make re-writing URLs a piece of cake"