Ubuntu/Apache/Eruby

I have an eruby application that I need to run on a machine with apache (and also some Rails stuff, but I suspect that is not a problem), and I
am having a difficult time making the configuration work on Ubuntu that
works on CentOS for eruby:

AddType application/x-httpd-eruby .rhtml
     #use which path:
     Action application/x-httpd-eruby "/usr/bin/eruby"
     AddType application/x-httpd-cgi .rhtml
     #not really needed
     AddHandler cgi-script .cgi

#ScriptInterpreterSource Registry
#ScriptInterpreterSource registry

DirectoryIndex <b>index.rhtml</b> index.html index.htm
----snip----
The main problem appears to be that Ubuntu Apache2 doesn't know about the 'Action' directive, but presumably there is a canonical way to do
the configuration on Ubuntu. Anybody know?

Xeno Campanoli wrote:

I have an eruby application that I need to run on a machine with apache (and also some Rails stuff, but I suspect that is not a problem), and I
am having a difficult time making the configuration work on Ubuntu that
works on CentOS for eruby:

Never Mind. I got it. I did some searches again, presumably with a clear head this time, and came up with this example:

http://ubuntuforums.org/archive/index.php/t-356350.html:

kson
February 8th, 2007, 10:36 AM
I had some problem finding any good information about this issue but got it to work so I decided to share my knowledge.

The goal for this project is to configure apache so that it opens .rbx files with mod_ruby and .rhtml with eRuby and preferably run eRuby through mod_ruby for better speed.

First install:
sudo apt-get install ruby libapache2-mod-ruby eruby

Then activate the apache module (dont remember if this is done automaticly)
sudo a2enmod ruby

Now the tricky part. Create a file in /etc/apache2/conf.d/ (preferably 'ruby.conf' or similar) with this content:

AddType text/html .rhtml

<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
RubyRequire apache/eruby-run

# Execute *.rbx files as Ruby scripts
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>

# Handle *.rhtml files as eRuby files
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>

Then restart apache
sudo /etc/init.d/apache2 restart

Thats it! (I think :))

You can test your installation with two files like these:
rubyTest.rbx
puts "<html><body><h1>Hello World</h1></body></html>"
eRubyTest.rhtml
<html><body><h1><% puts "Hello World" %></h1></body></html>

If someone uses this and think it works or if I forgot something, please post it here. And if this is wrong forum for this kind of stuff, then please move the thread to a better position. I couldnt find any.

···

AddType application/x-httpd-eruby .rhtml
    #use which path:
    Action application/x-httpd-eruby "/usr/bin/eruby"
    AddType application/x-httpd-cgi .rhtml
    #not really needed
    AddHandler cgi-script .cgi

#ScriptInterpreterSource Registry
#ScriptInterpreterSource registry

DirectoryIndex <b>index.rhtml</b> index.html index.htm
----snip----
The main problem appears to be that Ubuntu Apache2 doesn't know about the 'Action' directive, but presumably there is a canonical way to do
the configuration on Ubuntu. Anybody know?