Eric D. Schabell: Setting up eruby with apache2

Thursday, November 23, 2006

Setting up eruby with apache2

I was trying to get my AbTLinux project trac site to display the ruby files in the browser today and thought it might save someone a bit of work by placing my solution here.
# 1)  installed eruby which gives you /usr/bin/eruby.

# 2) copy or symlink eruby to the apache2 cgi-bin direcotry. 
{cp | link -s} /usr/bin/eruby  apache2/cgi-bin/eruby

# 3) add the following code to your apache2 httpd.conf file.

AddType application/x-httpd-eruby .rhtml 
Action application/x-httpd-eruby /cgi-bin/eruby

# 4) add ruby file extensions to the DirectoryIndex 
#    directive, so it looks something like this. 

DirectoryIndex index.html index.shtml index.rhtml 
Just restart apache2 and you are ready to go, see the AbTLinux trac browser for the results! ;-)