浅析Ruby on Rails部署方案

[url]http://blog.csdn.net/jrckkyy/article/details/2501136[/url]


[url]http://binku.iteye.com/blog/483687[/url]
apache+passenger部署rails应用

(1)安装apache: sudo apt-get install apache2
(2)安装passenger
$ sudo gem install passenger
$ passenger-install-apache2-module
安装到最後时,会出现如下的3条语句:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby1.8
把三条语句复制到/etc/apache2/apache2.conf的最后
(3)在/etc/apache2/sites-available下面创建available的应用配置
$ sudo touch /etc/apache2/sites-available/rails-app
打开rails-app,加入以下语句:
<VirtualHost *:80>
# RailsEnv development 加上这句的话,以development的模式部署
ServerName binku.com
DocumentRoot /home/binku/programme/rails-app/public
</VirtualHost>
(4)创建软链接,把available的应用程序配置链接到/etc/apache2/sites-enabled下面,apache将读取该文件夹下的配置.
$ sudo ln -s /etc/apache2/sites-available/rails-app /etc/apache2/sites-enabled/rails-app
(5)如果要设置虚拟主机的ip可以修改/etc/hosts,加上
127.0.0.1 localhost
172.17.21.119 binku.com
(6)如果以production模式部署的话,要记得创建production的数据库
$ rake db:create RAILS_ENV=production
$ rake db:migration RAILS_ENV=production
(7)重启apache:sudo /etc/init.d/apache2 restart,现在就可以在浏览器访问rails应用了.
重启apache前可以打开error日志看看启动有没有出错:tail -f /var/log/apache2/error.log
(8)修改完程序后,如果要重新部署可以输入:
touch rails-app/tmp/restart.txt
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值