2. 安装Ruby
# tar -zxvf ruby-1.8.2.tar.gz
# cd ruby-1.8.2
# ./configure --prefix=/usr/local/ruby
# make
# make install
3. 安装Apache
# tar zxvf httpd-2.0.54.tar.gz
# cd httpd-2.0.54
# ./configure --prefix=/usr/local/apache --enable-module=so #配置Apache安装目录和模块加载
# make
# make install
4. 安装mod_ruby
# tar zxvf mod_ruby-1.2.4.tar.gz
# cd mod_ruby-1.2.4
# ./configure.rb --with-apxs=/usr/local/apache/bin/apxs #指定Apache模块目录
# make
# make install
# 合并Apache和mod_ruby
编辑 /usr/local/apache/conf/httpd.conf文件,加入以下内容:
LoadModule ruby_module /usr/local/apache/modules/mod_ruby.so
<IfModule mod_ruby.c>
# for Apache::RubyRun
RubyRequire apache/ruby-run
# exec files under /ruby as ruby scripts.
<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options +ExecCGI
</Location>
# exec *.rbx as ruby scripts.
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
# # for Apache::ERubyRun
# RubyRequire apache/eruby-run
#
# # handle files under /eruby as eRuby files by eruby.
# <Location /eruby>
# SetHandler ruby-object
# RubyHandler Apache::ERubyRun.instance
# </Location>
#
# # handle *.rhtml as eruby files.
# <Files *.rhtml>
# SetHandler ruby-object
# RubyHandler Apache::ERubyRun.instance
# </Files>
# # for Apache::ERbRun
# RubyRequire apache/erb-run
#
# # handle files under /erb as eRuby files by ERb.
# <Location /erb>
# SetHandler ruby-object
# RubyHandler Apache::ERbRun.instance
# </Location>
# # for debug
# RubyRequire auto-reload
</IfModule>
# 启动Apache
# /usr/local/apache/bin/apachectl start
5. 安装eRuby
# tar -zxvf eruby-1.0.5.tar.gz
# cd eruby-1.0.5
# ./configure.rb
# make
# make install