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

[root@www ~]# yum install ruby* -y

2. 更新ruby

[root@www ~]# gem update --system
[root@www ~]# gem update

3.install Rails and dependencies

[root@www~]gem install rails –include-dependencies

4.安装常用的gem包

[root@www ~]# gem install ruby-debug ruby-debug-base sqlite3-ruby
Successfully installed ruby-debug-0.10.2
Building native extensions. This could take a while...
Successfully installed ruby-debug-base-0.10.2
Building native extensions. This could take a while...
Successfully installed sqlite3-ruby-1.2.4

3 gems installed

Installing ri documentation for ruby-debug-0.10.2...
Installing ri documentation for ruby-debug-base-0.10.2...
Installing ri documentation for sqlite3-ruby-1.2.4...
Installing RDoc documentation for ruby-debug-0.10.2...
Installing RDoc documentation for ruby-debug-base-0.10.2...
Installing RDoc documentation for sqlite3-ruby-1.2.4...
[root@www ~]#

5. install Mongrel
方法同4

[root@www ~]# gem install mongrel

6. 若使用mysql, 还可能需要执行以下操作

[root@www ~]# yum install mysql*
[root@www ~]# gem install mysql

7. 安装 & 配置Apache

[root@www~]yum install httpd

新建/etc/httpd/conf.d/rails.conf内容如下

Listen 8080

ProxyRequests Off

BalancerMember :3001
BalancerMember :3002
#BalancerMember :3003
#BalancerMember :3004
#BalancerMember :3005

ServerName :8080
DocumentRoot /var/www/beeblio/public
ProxyPass /image !
ProxyPass /stylesheets !
ProxyPass /javascripts !
ProxyPass / balancer://myCluster/
ProxyPassReverse / balancer://myCluster/
ProxyPreserveHost on


然后在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,试试地址栏中输入:8080,该工作了吧?

[root@www~]service httpd restart 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a6113a1d5b70e0cc83cf5862aa425724.html