之前在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 |