配置apache +mongrel单实例

 

背景:
OS: CentOS release 3.6 (Final)
Apache: Apache/2.0.46
 
开始配置Apache+mongrel+rails
 
  1. 安装ruby
wget ftp://ftp.ruby-lang.org/pub/ruby/ 1.8 /ruby- 1.8.6 -p110.tar.gz
tar xzvf ruby-
1.8.6 -p110.tar.gz
cd ruby-
1.8.6 -p110
./configure --prefix
= /usr/local/ruby
make && make install
 
在/etc/proifle中加入
export PATH = /usr/local/ruby/bin:$PATH
 
2)安装gem
wget http://rubyforge.org/frs/download.php/ 17190 /rubygems- 0.9.2 .tgz
tar xzvf rubygems-
0.9.2 .tgz
cd rubygems-
0.9.2
ruby setup.rb
 
3)安装rails
gem install rails --include-dependencies
 
4)安装mongrel 
gem install mongrel --include-dependencies
Select which gem to install for your platform (i686-linux)
 1. mongrel 1.0.1 (mswin32)
 2. mongrel 1.0.1 (ruby)
 3. mongrel 1.0 (mswin32)
 4. mongrel 1.0 (ruby)
 5. Skip this gem
 6. Cancel installation
2
Select which gem to install for your platform (i686-linux)
 1. fastthread 1.0 (ruby)
 2. fastthread 1.0 (mswin32)
 3. fastthread 0.6.4.1 (mswin32)
 4. fastthread 0.6.4.1 (ruby)
 5. Skip this gem
 6. Cancel installation
1
 
5)启动mongrel
cd ${your_rails_app_root}
mongrel_rails start -e production -p 
8080  -r public -l log/m.log -P tmp/pids/dispatch .0 .pid -d
 
6)配置 apache
通过命令:httpd -version
发现:Apache/2.0.46
Apache已安装,于是开始略过安装过程直接配置:
vi /etc/httpd/conf/httpd.conf
文件最后加入:
<VirtualHost *: 80 >
    ServerName space.mofile.com
 
 
   ErrorLog logs/space.mo.com-error_log
   CustomLog logs/space.mo.com-access_log common
 
    ProxyPass / http://
127.0.0.1 : 8080 /
    ProxyPassReverse / http://
127.0.0.1 : 8080
    ProxyPreserveHost on
 </VirtualHost>
 
注意:
1)上面对于apache得配置很粗糙,把所有的请求到推倒了mongrel实例,产品环境中显然是不行的,apache作为反向代理,最好是指把动态请求推给mongrel实例。
2)  仅有单个mongrel实例使得请求变成了单进程,并发性能不太好
对于小流量的网站无所谓,一旦压力增大,恐怕就的考虑Apache+Mongrel_cluster
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值