mod_ruby and eRuby

I finally had some time to install mod_ruby and eRuby on my server.

Prerequisites:
httpd-devel ruby ruby-devel eruby
yum install httpd-devel ruby ruby-devel eruby

Installing mod_ruby was pretty confusing, as module default compilation is intended for Apache 1.3 (not why this is the case)

If you’re running Apache 2.0 or higher, I managed to successfully compiled mod_ruby as the following:
./configure.rb –with-apr-includes=/usr/include/apr-1
make
make install

After the install, then its a matter of just adding the custom ruby http conf file to httpd conf.d directory.

SAMPLE:

AddType text/html .rhtml
LoadModule ruby_module modules/mod_ruby.so


RubyRequire apache/ruby-run
#RubyRequire apache/ruby-debug

RubyRequire apache/eruby-run
#RubyRequire apache/eruby-debug

# Execute *.rbx files as Ruby scripts

Options ExecCGI
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
#RubyHandler Apache::RubyDebug.instance

# Handle *.rhtml files as eRuby files

SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
RubyHandler Apache::ERubyDebug.instance


Now I can embed Ruby code on standard html pages serving and running natively using Apache and eRuby. :-)
Hence, perlninja.pl

References:
http://www.modruby.net/en/
http://www.ptwit.ac.th/seksan/blog/?p=59

Leave a Reply

Your email address will not be published. Required fields are marked *