在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
来源:互联网 发布:php云人才系统 编辑:程序博客网 时间:2024/05/14 03:17
在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
一、安装Ruby、rails、mongrel和Apache2.2
从rubyforge网站下载One-Click Ruby Install,运行安装程序,就安装好了ruby和rubygems。
运行命令:
gem install rails
gem install mongrel
//出现选择窗口时,选择2:mongrel 1.1.5(x86-msvin32-60)
//出现选择窗口时,选择2:mongrel 1.1.5(x86-msvin32-60)
gem install mongrel_service
//出现选择窗口时,一直选择1
//出现选择窗口时,一直选择1
安装好了rails和mongrel
gem_plugin-0.2.1.gem
win32-service-0.5.0-mswin32.gem
mongrel-0.3.13.3-mswin32.gem
mongrel_service-0.1.gem
下载到 rubyforge.org 搜索
编写 批处理 安装,由于有依赖关系,必须按照顺序
call gem install gem_plugin-0.2.1.gem
call gem install win32-service-0.5.0-mswin32.gem
call gem install mongrel-0.3.13.3-mswin32.gem
call gem install mongrel_service-0.1.gem
运行批处理文件即可,也可详细写上地址:
call gem install D:/ruby_server/rake-0.7.1.gem
call gem install D:/ruby_server/gem_plugin-0.2.1.gem
call gem install D:/ruby_server/win32-service-0.5.2-mswin32.gem
call gem install D:/ruby_server/mongrel-0.3.13.3-mswin32.gem
call gem install D:/ruby_server/mongrel_service-0.1.gem
路径自定,存成bat
手动安装mongrel方法
手动下载以下安装包gem_plugin-0.2.1.gem
win32-service-0.5.0-mswin32.gem
mongrel-0.3.13.3-mswin32.gem
mongrel_service-0.1.gem
下载到 rubyforge.org 搜索
编写 批处理 安装,由于有依赖关系,必须按照顺序
call gem install gem_plugin-0.2.1.gem
call gem install win32-service-0.5.0-mswin32.gem
call gem install mongrel-0.3.13.3-mswin32.gem
call gem install mongrel_service-0.1.gem
运行批处理文件即可,也可详细写上地址:
call gem install D:/ruby_server/rake-0.7.1.gem
call gem install D:/ruby_server/gem_plugin-0.2.1.gem
call gem install D:/ruby_server/win32-service-0.5.2-mswin32.gem
call gem install D:/ruby_server/mongrel-0.3.13.3-mswin32.gem
call gem install D:/ruby_server/mongrel_service-0.1.gem
路径自定,存成bat
从Apache网站下载Windows版本的Apache2.2,运行安装程序,就安装好了Apache2.2。
二、把Mongrel作为Services启动
mongrel_rails service::install -N depot -c "E:/server/human" -p 1234 –e production
-N指明服务名称,-d指明rails应用的目录,-p是mongrel监听的tcp端口,-e是启动模式为生产模式
这样打开控制面版|管理工具|服务,就可以发现增加了一项名为“depot”的服务,就可以通过控制面版来管理服务了。如果需要命令行启动和关闭该服务,那么:
mongrel_rails service::start -N depot
mongrel_rails service::stop -N depot
如果需要从服务中注销该项服务,那么:
mongrel_rails service::remove -N depot
如果需要安装多个mongrel实例,那么可以这样:
mongrel_rails service::install -N depot0 -c d:/Rubyproject/depot -p 3000 –e production
mongrel_rails service::install -N depot1 -c d:/Rubyproject/depot -p 3001 –e production
诸如此类。
三、配置Apache2.2
用编辑工具打开Apache2.2目录下面的conf/httpd.conf,需要取消如下模块的注释:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
如果你希望对页面输出使用压缩,也需要取消如下模块的注释:
LoadModule deflate_module modules/mod_deflate.so
然后按如下内容配置基于HTTP代理的负载均衡:
xml 代码
- ProxyRequests Off
- <Proxy balancer://myCluster>
- BalancerMember http://localhost:3000
- BalancerMember http://localhost:3001
- >
- <VirtualHost *:80>
- ServerName www.xxx.com
- DocumentRoot d:/rubyproject/depot/public
- ProxyPass /images !
- ProxyPass /stylesheets !
- ProxyPass /javascripts !
- ProxyPass / balancer://myCluster/
- ProxyPassReverse / balancer://myCluster/
- ProxyPreserveHost on
- >
myCluster 定义了群集中的每个mongrel应用服务器节点。ProxyPass /images !指明该URL开始的请求不代理给Mongrel群集,而由Apache自己处理。重起Apache,然后打开浏览器访问www.xxx.com,检查配 置是否正确。
至此,在Windows Server上面一个具备良好稳定性和性能的Ruby on rails生产环境就搭建好了。
对于页面输出,还可以使用mod_deflate进行输出内容压缩,以提高页面下载速度,这个就留给大家自己配置了。
Powered by ScribeFire.
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- Windows 安装Apache2.2和Mongrel运行Ruby on Rails
- 【Ruby on Rails 起步(二)】Windows下搭建RubyonRails 3.0.4 + Mongrel 1.2.0 pre + Apache2.2.17服务器
- 让Ruby On Rails抛在NginX + Mongrel上
- 新人千万不要在 Windows 上使用 Ruby on Rails
- 新人千万不要在 Windows 上使用 Ruby on Rails
- 新人千万不要在 Windows 上使用 Ruby on Rails
- 新人千万不要在 Windows 上使用 Ruby on Rails
- Topcoder_15
- 快乐自己找
- asp 图片上传程序
- 我个人对二维数组的深刻理解
- 丛jsp发送动态图像
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- asp图片上传程序demo
- 百科知识
- qeqwe
- 无聊
- 获取GridView/UserControl生成的Html代码
- ActionForm
- javascript 录入框、警告框、确认框
- gallery的2个问题