Rails 0.10.0 loves lighttpd

With the release of Rails 0.10.0, the reign of Apache has finally ended and equal opportunity for all web servers has been introduced. The most important beneficial of this is lighttpd. The server describes itself as “…a secure, fast, compliant and very flexible web-server which has been optimized for high-performance environments” and is catching the attention of a lot of people lately.

Personally, I’ve been most interested in its FastCGI implementation that includes a load balancer component. But whether you need that or not, you owe it to yourself to check out lighttpd. Here’s a sample minimal configuration file needed to setup lighttpd to run a Rails application under FastCGI:


server.port = 8080
server.bind = "127.0.0.1"
# Needed on OS X: server.event-handler = "freebsd-kqueue"
 
server.modules = ( "mod_rewrite", "mod_fastcgi" )
 
url.rewrite = ( "^/$" =>"index.html", "^([^.]+)$" =>"$1.html" )
server.error-handler-404 = "/dispatch.fcgi"
 
server.document-root = "/path/application/public"
server.errorlog      = "/path/application/log/server.log"
 
fastcgi.server = ( ".fcgi" => ( "localhost" => (
 "min-procs" => 1,  "max-procs" => 5,
 "socket"   =>"/tmp/application.fcgi.socket",
 "bin-path" =>"/path/application/public/dispatch.fcgi",
 "bin-environment" => ( "RAILS_ENV" =>"development" )
) ) )

This configuration is also to be found in the README file of new Rails installations.

blog comments powered by Disqus