multiple Rails sites running with lighttpd on the same domain
2006年7月26日星期三
Well, it was a pain in the ass, but I managed to get multiple Rails sites running with lighttpd on the same domain.
Check it out! colloboa install 1 and colloboa install 2. They’re running off collaboa, which is a rails app.
Here’s the interesting parts of the lighttpd.conf file that makes this magic shit work:
# needed for aliases to work
server.modules = ( "mod_rewrite", "mod_fastcgi", "mod_alias" )
$HTTP["url"] =~ "^/svn_browser/cisv" {
server.document-root ="http://www.uuzone.com/users/home/joevd/domains/joevandyk.com/cisv_collaboa/public/"
alias.url = ( "/svn_browser/cisv" => "/users/home/joevd/domains/joevandyk.com/cisv_collaboa/public" )
server.error-handler-404 ="http://www.uuzone.com/svn_browser/cisv/dispatch.fcgi"
server.indexfiles = ( "dispatch.fcgi", "index.html" )
fastcgi.server = ( ".fcgi" =>
((
"socket" => "/home/joevd/lighttpd/joevd_cisv_svn1.socket",
"min-procs" => 1,
"max-procs" => 1,
"bin-path" => "/users/home/joevd/domains/joevandyk.com/cisv_collaboa/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "production" )
)))
}
$HTTP["url"] =~ "^/svn_browser/gamefest" {
server.document-root ="http://www.uuzone.com/users/home/joevd/domains/joevandyk.com/gamefest_collaboa/public/"
alias.url = ( "/svn_browser/gamefest" => "/users/home/joevd/domains/joevandyk.com/gamefest_collaboa/public" )
server.error-handler-404 ="http://www.uuzone.com/svn_browser/gamefest/dispatch.fcgi"
server.indexfiles = ( "dispatch.fcgi", "index.html" )
fastcgi.server = ( ".fcgi" =>
((
"socket" => "/home/joevd/lighttpd/joevd_gamefest_svn1.socket",
"min-procs" => 1,
"max-procs" => 1,
"bin-path" => "/users/home/joevd/domains/joevandyk.com/gamefest_collaboa/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "production" )
)))
}
You also need to add the following to the app’s config/environment.rb file (at the very end):
ActionController::AbstractRequest.relative_url_root ="http://www.uuzone.com/svn_browser/cisv"
It’s a royal pain, but it’s pretty cool once you got a working configuration.
more resource:
http://forum.textdrive.com/viewtopic.php?id=7147&p=1
http://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps
标签: lighttpd, rails, Technologies
2006年7月25日星期二
标签: Technologies