search
Homephp教程PHP源码Ubuntu 7.1 server从无到有搭建jsp/php/rails全能WEB生产环境(五)

<script>ec(2);</script>

五、安装Rails环境

Rails环境使用Mongrel架设。
1、安装ruby
tar -zxvf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure –prefix=/usr/local/ruby
make
make install

将ruby加入PATH
vi /etc/profile
RUBY_HOME=/usr/local/ruby
PATH=”${RUBY_HOME}”/bin:”${JAVA_HOME}”/bin:/usr/local/mysql/bin:”${PATH}”
export PATH

退出root,重新用root登陆,验证ruby是否安装成功
ruby -v
显示版本号,说明安装成功

2、安装gem
tar -zxvf rubygems-0.9.4.tgz
cd rubygems-0.9.4
ruby setup.rb

rubygems-0.9.5好像有问题,无论gem什么包都说ssl没有安装,重新安装个rubygems-0.9.4就没问题了。
3、安装rails/mongrel/termios
apt-get install libssl-dev
gem install rake –include-dependencies
gem install rails –include-dependencies
gem install termios –include-dependencies
gem install mongrel –include-dependencies
gem install mongrel_cluster –include-dependencies

生成一个默认站点(或者将已经开发的网站上传,并配置好数据库)后,转到站点目录
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /home/dingl/rails-web/ -a 127.0.0.1
在database.yml中配置好数据库,这里是生产环境,配置production段。
如果需要使用socket方式连接mysql,增加:
socket: /tmp/mysql.sock
同时还可以指定数据传输编码:
encoding: utf8

4、启动mongrel:
mongrel_rails cluster::start

如果出现以下错误:
Cannot find gem for Rails ~>1.2.3.0:
Install the missing gem with ‘gem install -v=1.2.3 rails’
则修改config/environment.rb里rails的版本号即可

5、配置Apache与Mongrel:

修改apache的配置文件:
vi /usr/local/apache/conf/httpd.conf
在文件最后增加一个虚拟主机:

  ServerName http://www.111cn.net/
  RewriteEngine On
  DocumentRoot /home/dingl/rails-web/
  ProxyRequests Off
 
    BalancerMember http:/

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft