apache+passenger部署rails项目

1、安装apache
sudo apt-get install apache2

打开浏览器,请求http://localhost,出现如下界面,证明安装成功
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.


2、安装passenger和apache模块
sudo gem install passenger
sudo passenger-install-apache2-module

运行这个命令如果出现如下错误
sudo: passenger-install-apache2-module: command not found

说明gem的bin目录没有加到PATH下,
解决方法:
一是把gem的bin目录路径加到PATH下,参考[url]http://jadeluo.iteye.com/blog/940113[/url]
二是用全路径执行passenger-install-apache2-module,执行如下命令:
sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module

如果不知道gem的bin路径,执行命令:
gem environment

3、修改apache配置文件/etc/apache2/httpd.conf
在httpd.conf中增加如下内容:
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.5/ext/apache2/mod_passenger.so  
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.5
PassengerRuby /usr/bin/ruby1.8

<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
<Directory /somewhere/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>


4、重启apache,执行/etc/init.d/apache2 restart,出现如下错误:
Syntax error on line 7 of /etc/apache2/httpd.conf:DocumentRoot takes one argument, 
Root directory of the document treeAction 'configtest' failed.The Apache error log may have more information.
...fail!

解决如上错误,需要删除http.conf文件中 DocumentRoot /somewhere/public 后面的# <-- be sure to point to 'public'!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值