Mephisto, Multi-Site and Lighttpd

Tags: Uncategorized rails ruby mephisto lighttpd

After playing around with Lighttpd’s rewrite abilities, I think I have a set-up that enables Mephisto caching goodness. The following is how I have chosen to configure Mephisto, so your mileage may vary:

1) Install Mephisto in your home directory (MEPHISTO_HOME).

2) For each domain you want to set-up, use a config like this:

$HTTP["host"] =~ "foo.com" {
  server.document-root = foo_com_docroot
  server.error-handler-404 = "/mephisto/dispatch.fcgi"
  url.rewrite = ( "/$" => "/mephisto/cache/foo.com/index.html", "/(images|stylesheets|javascripts)/mephisto/(.+)$" => "/mephisto/$1/mephisto/$2", "/(images|stylesheets|javascripts)/(.+)$" => "/mephisto/cache/foo.com/$1/$2", "/assets/(.+)$" => "/mephisto/assets/foo.com/$1", "/([.]+)$" => "/mephisto/cache/foo.com/$1.html" )
  fastcgi.server = ( ".fcgi" =>
   ( "localhost" =>
     ( "socket" => "/home/YOU/var/run/lighttpd-fcgi-blog.socket",
       "bin-path" => mephisto_root + "/dispatch.fcgi",
       "bin-environment" => ( "RAILS_ENV" => "production" ),
       "min-procs" => 1, "max-procs" => 2, "idle-timeout" => 60 )
     )
   )
}

3) In the docroot for foo.com (~/domains/foo.com/web/public, etc) create a symlink to your mephisto public folder:

cd ~/domains/foo.com/web/public; ln -s ~/mephisto/public mephisto

That’s it! I hope I’m not forgetting anything. Feedback would be appreciated.

About Me

Hey there. My name is Carter Rabasa and I am a husband and father of two beautiful daughters Catherine and Emily. I live in Seattle, WA.