lighttpd + ruby + rails

This howto is for etch.

ruby

 # apt-get install ruby ruby1.8 rake rdoc irb libyaml-ruby libmysql-ruby1.8 libredcloth-ruby1.8 liberb-ruby

rails

via package (not recommended):
bc. # apt-get install rails

or via gems (recommended):

# wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
# tar xzvf rubygems-0.9.0.tgz
# cd rubygems-0.9.0
# ruby setup.rb
# gem update --system
# gem install rails -y

visit rubyforge.org/frs/?group_id=126 to see what the latest stable gems is.

lighttpd

 # apt-get install lighttpd libfcgi-ruby1.8

development use

run script/server from your rails project home and it will create a config/lighttpd.conf.
For development work, this is enough, you can just run script/server. If you want your server to host multiple rails projects, read on.

production use

create /etc/lighttpd/conf-available/20-myproject.conf:

$HTTP["host"] =~ "^labs.riseup.net$" {
  var.basedir = "/var/www/decider"
  server.error-handler-404 = "/dispatch.fcgi"
  server.document-root     = var.basedir + "/public/"
  url.rewrite              = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )

  fastcgi.server      = ( ".fcgi" => ( "localhost" => (
    "min-procs"       => 1,
    "max-procs"       => 3,
    "socket"          => var.basedir + "/tmp/sockets/fcgi.socket",
    "bin-path"        => var.basedir + "/public/dispatch.fcgi",
    "bin-environment" => ( "RAILS_ENV" => "production" )
  ) ) )
}

Enable the configuration:

 # lighty-enable-mod myproject

Make sure these modules (at least) are enabled in the global /etc/lighttpd/lighttpd.conf:

 server.modules = ("mod_rewrite","mod_redirect","mod_fastcgi")

links

Virtual Hosting Rails Applications with LightTPD
duncandavidson.com/essay/2006/01/railsv...