<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/plusone.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 Cloud Service, Smart Hardware, Architecture, Technic and beyond…

使用Mongrel替代scgi

2006年9月28日星期四

之前在Windows计算机上开发Rails Application , 使用的是 lighttpd+scgi, 后来看到 Mongrel升级了,但由于不支持Ruby 1.8.2 ,所以一直都没有更换。前几天由于需要使用 Multibyte for Rails , 将Ruby 1.8.2 升级为了 1.8.4版本,所以将原来开发环境中使用的 lighttpd+scgi 也更换为了 lighttpd+Mongrel ,这是在Windows平台下开发RubyonRails应用的首选,附安装步骤:


1.安装Mongrel


$ gem install win32-service (pick the most recent one)

$ gem install mongrel (pick the win32 pre-built)

$ gem install mongrel_service


2.运行Mongrel服务(多个应用)


$ mongrel_rails service::install -N myapp1   

   -c c:mypathtomyapp1 -p 4000 -e production 

$ mongrel_rails service::start -N myapp1


$ mongrel_rails service::install -N myapp2   

   -c c:mypathtomyapp2 -p 4001 -e production 

$ mongrel_rails service::start -N myapp2

3.配置Lighttpd


server.modules = (”mod_proxy”,

“mod_rewrite”,

“mod_accesslog”,

“mod_alias” )


$HTTP[”url”] =~ “^/myapp1/” {

proxy.server = (”" => (

(”host” => “127.0.0.1″,”port” => 4000)

)

)

}


$HTTP[”url”] =~ “^/myapp2/” {

proxy.server = (”" => (

(”host” => “127.0.0.1″,”port” => 4001)

)

)

}


3.访问路径


http://localhost/myapp1


http://localhost/myapp2


标签:

posted by Jesse Cai, 上午6:22

0 Comments:

发表评论

订阅 帖子评论 [Atom]

<< 主页