Lighttpd config:
#... normal lighty conf... server.document-root = "/home/rails/app/public/" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ("localhost" => ( "min-procs" => 1, "max-procs" => 1, "socket" => "/tmp/rails-fcgi1.socket", "bin-path" => "/home/rails/app/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "production", "TZ" => "America/Chicago" ) ) ) ) $HTTP["host"] =~ "site1.net" { server.document-root = "/home/rails/app/public/site1.net" } $HTTP["host"] =~ "site2.net" { server.document-root = "/home/rails/app/public/site2.net" }
Rails code to set the page cache directory:
before_filter { |c| c.class.page_cache_directory = "#{RAILS_ROOT}/public/#{c.request.host}" }
Remember to symlink your necessary files AND your dispatch.fcgi to each page cache directory.