Fedora 9 下使用apache+mongrel+rails轻松架设ROR应用


1. 安装 ruby
  1. [root@www ~]# yum install ruby* -y

2. 更新ruby
  1. [root@www ~]# gem update --system
  2. [root@www ~]# gem update
3.install Rails and dependencies
  1. [root@www~]gem install rails –include-dependencies
4.安装常用的gem包
 
  1. [root@www ~]# gem install ruby-debug ruby-debug-base sqlite3-ruby
  2. Successfully installed ruby-debug-0.10.2
  3. Building native extensions.  This could take a while...
  4. Successfully installed ruby-debug-base-0.10.2
  5. Building native extensions.  This could take a while...
  6. Successfully installed sqlite3-ruby-1.2.4
  7. 3 gems installed
  8. Installing ri documentation for ruby-debug-0.10.2...
  9. Installing ri documentation for ruby-debug-base-0.10.2...
  10. Installing ri documentation for sqlite3-ruby-1.2.4...
  11. Installing RDoc documentation for ruby-debug-0.10.2...
  12. Installing RDoc documentation for ruby-debug-base-0.10.2...
  13. Installing RDoc documentation for sqlite3-ruby-1.2.4...
  14. [root@www ~]# 

5. install Mongrel
方法同4
  1. [root@www ~]# gem install mongrel
6. 若使用mysql, 还可能需要执行以下操作
  1. [root@www ~]# yum install mysql*
  2. [root@www ~]# gem install mysql

7. 安装 & 配置Apache

  1. [root@www~]yum install httpd
新建/etc/httpd/conf.d/rails.conf内容如下
 
  1. Listen 8080
  2. ProxyRequests Off
  3. <Proxy balancer://myCluster>
  4. BalancerMember http://127.0.0.1:3001
  5. BalancerMember http://127.0.0.1:3002
  6. #BalancerMember http://127.0.0.1:3003
  7. #BalancerMember http://127.0.0.1:3004
  8. #BalancerMember http://127.0.0.1:3005
  9. </Proxy>
  10. <VirtualHost *:8080>
  11. ServerName www.laiyunqing.com:8080
  12. DocumentRoot /var/www/beeblio/public
  13. ProxyPass /image !
  14. ProxyPass /stylesheets !
  15. ProxyPass /javascripts !
  16. ProxyPass / balancer://myCluster/
  17. ProxyPassReverse / balancer://myCluster/
  18. ProxyPreserveHost on
  19. </VirtualHost>
然后在3001,3002...3005端口启动mongrel
mongrel_rails start -e production -p 3001 -d -c /var/www/beeblio/ -P /var/www/beeblio/log/mongrel-3001.pid
mongrel_rails start -e production -p 3001 -d -c /var/www/beeblio/ -P /var/www/beeblio/log/mongrel-3002.pid
...
8. 重启apache,试试地址栏中输入http://localhost:8080,该工作了吧?
  1. [root@www~]service httpd restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值