配置apache +mongrel单实例
2007-11-22 17:28
134 查看
背景:
OS: CentOS release 3.6 (Final)
Apache: Apache/2.0.46
开始配置Apache+mongrel+rails
安装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
OS: CentOS release 3.6 (Final)
Apache: Apache/2.0.46
开始配置Apache+mongrel+rails
安装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
相关文章推荐
- Apache本地配置多个虚拟主机实例教程
- Apache UrlRewrite 的配置和使用 实例
- 同一Windows主机上一个Apache服务+两个独立Tomcat服务配置实例
- 实例配置apache2.2.14+svn1.6.6.txt
- Apache2.2+php5.4在windows上配置实例
- apache配置方式实现伪静态(网站实例)
- Apache中配置支持CORS(跨域资源共享)实例
- Apache 虚拟主机配置实例
- 关于apache虚拟主机深入配置实例 推荐
- Apache 配置实例
- Apache JMeter配置安装及测试实例
- Apache Thrift 配置与简单实例——C# C/S 通信
- Nginx和Apache几种防盗链配置方法实例
- Apache Thrift 配置与简单实例——C# C/S 通信
- Linux网络服务-Web Service之【apache的功能、安装、配置文件介绍以及实验实例】(三)
- 如何配置apache虚拟主机的实例小结
- Apache 多端口多站点配置实例
- Apache http.conf 实例配置详解
- apache等的参数配置实例
- linux系统配置Apache虚拟主机实例