分享

冰狗的部落-搭建Apache Mongrel 最佳RoR Web服务器平台

 鱼非鱼 2007-03-24

搭建Apache + Mongrel 最佳RoR Web服务器平台

搭建Apache + Mongrel 最佳RoR Web服务器平台
作者:Charles Brian Quinn
原文链接:http://mongrel./docs/apache.html

当下最佳rails 站点部署应该是 利用Apache 2.2.3的mod_proxy_balancer为Mongrel作负载均衡。
刚上线的站点,Mongrel虽然稍显慢些,但也足够支撑。先把站做好了,再考虑大流量冲击吧。
安装Mongrel的过程(前提已经按好带rubygem的ruby+rails):
gem install win32-service #在更新下来的列表里选择最新版本安装
gem install mongrel #选择最新 win32版本
gem install mongrel_service
成功在cmd console中运行完以上指令后,mongrel 已经安装成功
mongrel 的命令使用方法:
mongrel_rails /-h #查看所有命令
mongrel_rails service::install #查看 service::install 命令的帮助说明

开始使用Mongrel:
mongrel_rails service::install -N myapp -c c:\myapp -p 4000 -e production # 表示部署一个名叫myapp的站点,它的物理路径是c:\myapp,它的端口号是4000 ,运行在发布环境中

mongrel_rails service::start -N myapp # 启动名叫myapp这个站点服务

mongrel_rails service::stop -N myapp # 停止名叫myapp站点服务

另外可以在windows系统中的服务台中设置开机自动启动站点服务的选项

下一步,开始设置Apache

ServerName
ServerAlias www.

ProxyPass / http://www.:8000/
ProxyPassReverse / http://www.:8000
ProxyPreserveHost on


将静态文件的请求留给Apache来处理,因为它更擅长
ProxyPass /images !
ProxyPass /stylesheets !
#continue with other static files that should be served by apache

Alias /images /path/to/public/images
Alias /stylesheets /path/to/public/stylesheets
#continue with aliases for static content

注:未完,后边还有多Mongrel进程服务和负载均衡等高级应用,目前还未到那等级,到用时补上。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多