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

本文详细介绍了如何在Linux环境下安装Ruby、更新Ruby版本、安装Rails及其依赖组件,并配置Apache以支持Rails应用。此外,还提供了安装常用Gem包、Mongrel及MySQL的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


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

2. 更新ruby
  1. [root@www~]#gemupdate--system
  2. [root@www~]#gemupdate
3.install Rails and dependencies
  1. [root@www~]geminstallrails–include-dependencies
4.安装常用的gem包
  1. [root@www~]#geminstallruby-debugruby-debug-basesqlite3-ruby
  2. Successfullyinstalledruby-debug-0.10.2
  3. Buildingnativeextensions.Thiscouldtakeawhile...
  4. Successfullyinstalledruby-debug-base-0.10.2
  5. Buildingnativeextensions.Thiscouldtakeawhile...
  6. Successfullyinstalledsqlite3-ruby-1.2.4
  7. 3gemsinstalled
  8. Installingridocumentationforruby-debug-0.10.2...
  9. Installingridocumentationforruby-debug-base-0.10.2...
  10. Installingridocumentationforsqlite3-ruby-1.2.4...
  11. InstallingRDocdocumentationforruby-debug-0.10.2...
  12. InstallingRDocdocumentationforruby-debug-base-0.10.2...
  13. InstallingRDocdocumentationforsqlite3-ruby-1.2.4...
  14. [root@www~]#

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

7. 安装 & 配置Apache

  1. [root@www~]yuminstallhttpd
新建/etc/httpd/conf.d/rails.conf内容如下
  1. Listen8080
  2. ProxyRequestsOff
  3. <Proxybalancer://myCluster>
  4. BalancerMemberhttp://127.0.0.1:3001
  5. BalancerMemberhttp://127.0.0.1:3002
  6. #BalancerMemberhttp://127.0.0.1:3003
  7. #BalancerMemberhttp://127.0.0.1:3004
  8. #BalancerMemberhttp://127.0.0.1:3005
  9. </Proxy>
  10. <VirtualHost*:8080>
  11. ServerNamewww.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. ProxyPreserveHoston
  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~]servicehttpdrestart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值