Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

WanCW

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Multiple Rails Applications with lighttpd

# lighttpd.conf
$HTTP["url"] =~ "^/base_url_to_app1/" {
  server.document-root = "/path/to/app1/public/"
  alias.url = ( "/base_url_to_app1/" => "/path/to/app1/public/" )
  server.error-handler-404 = "/base_url_to_app1/dispatch.fcgi"
  fastcgi.server = (
    ".fcgi" => ( (
      "socket" => "/tmp/app1.socket",
      "bin-path" =>  "/path/to/app1/public/dispatch.fcgi",
    ) )
  )
}

$HTTP["url"] =~ "^/base_url_to_app2/" {
  # ...
}


# config/environment.rb
module ActionController
  class AbstractRequest
    alias_method :orig_rel_url_root, :relative_url_root
    def relative_url_root
      if (@env['SCRIPT_NAME'] && /\/dispatch\.(fcgi|rb|cgi)$/ =~ @env['SCRIPT_NAME'])
        @env["SCRIPT_NAME"].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/, '')
      else
        orig_rel_url_root
      end
    end
  end
end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS