<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d4684235500622716427\x26blogName\x3dCaiwangqin\x27s+blog\x26publishMode\x3dPUBLISH_MODE_HOSTED\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://blog.caiwangqin.com/search\x26blogLocale\x3dzh_CN\x26v\x3d2\x26homepageUrl\x3dhttp://blog.caiwangqin.com/\x26vt\x3d3393395200455623441', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Caiwangqin's blog

Focus on Life, Cloud Service, Smart Hardware, Architecture, Technic and beyond…

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://pinkpucker.net/articles/2006/01/31/getting-multiple-rails-sites-going-on-one-domain-using-lighttpd


http://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps



标签: , ,

posted by Caiwangqin, 21:48 | Permalink | 0 comments |

2006年7月25日星期二


标签:

posted by Caiwangqin, 05:04 | Permalink | 0 comments |