<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/Setup+eRuby'
         s:cUser='john'
         s:oUser=''
         s:mUser='john'>
        <s:name>knowledgebase/linux/Setup eRuby</s:name>
        <s:content>If you would like to use embedded Ruby with Apache, so that you can embed ruby code into your html documents, here is a quick way to configure it. &#xD;&#xA;&#xD;&#xA;If you are going to use eRuby with a virtual host you will need to enable cgi programs. &#xD;&#xA;&#xD;&#xA;On Debian based distros the default cgi-bin is here, but you may need to insert this into your virtual host directive&#xD;&#xA;{code}&#xD;&#xA;ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;On RedHat/Fedora based distros  it looks like this&#xD;&#xA;{code}&#xD;&#xA;ScriptAlias /cgi-bin/ &quot;/var/www/cgi-bin/&quot; &#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Then copy this script into a file called eruby.sh or similar.   &#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;#!/bin/bash&#xD;&#xA;apt-get install -y eruby&#xD;&#xA;&#xD;&#xA;if [ -e /etc/redhat-release ]; then&#xD;&#xA;touch /etc/httpd/conf.d/eruby.conf&#xD;&#xA;echo &quot;Action application/x-httpd-eruby /cgi-bin/eruby&quot; &gt; /etc/httpd/conf.d/eruby.conf&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;if [ -e /etc/debian-release ]; then&#xD;&#xA;touch /etc/apache2/conf.d/eruby.conf&#xD;&#xA;echo &quot;Action application/x-httpd-eruby /cgi-bin/eruby&quot; &gt; /etc/apache2/conf.d/eruby.conf&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;echo &quot;application/x-httpd-eruby                       rhtml&quot; &gt;&gt; /etc/mime.types&#xD;&#xA;&#xD;&#xA;if [ -e /etc/debian-release ]; then&#xD;&#xA;ln -s $(which eruby) /usr/lib/cgi-bin/eruby&#xD;&#xA;a2enmod actions&#xD;&#xA;/etc/init.d/apache2 restart&#xD;&#xA;echo &apos;&lt;% puts &quot;Hello World!&quot; %&gt;&apos; &gt; /var/www/test.rhtml&#xD;&#xA;fi &#xD;&#xA;&#xD;&#xA;# afaik the actions module is enabled on fedora &#xD;&#xA;if [ -e /etc/redhat-release ]; then&#xD;&#xA;ln -s $(which eruby) /var/www/cgi-bin/eruby &#xD;&#xA;echo &apos;&lt;% puts &quot;Hello World!&quot; %&gt;&apos; &gt; /var/www/html/test.rhtml&#xD;&#xA;fi &#xD;&#xA;&#xD;&#xA;# Restart Apache &#xD;&#xA;&#xD;&#xA;if [ -e /etc/debian-release ]; then &#xD;&#xA;/etc/init.d/apache2 restart&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;if [ -e /etc/redhat-release ]; then&#xD;&#xA;/etc/init.d/httpd restart&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Now browse to http://yourdomain/test.rhtml and see that it works. &#xD;&#xA;&#xD;&#xA;This will allow you to experiment with inline Ruby programing in your html pages, but if your seriously looking to use eruby you might want to consider using mod_ruby, more information here:&#xD;&#xA;&#xD;&#xA;http://wiki.modruby.net/en/?InstallGuide&#xD;&#xA;&#xD;&#xA;This script was suggested by what I read on this page:&#xD;&#xA;&#xD;&#xA;http://www.rubycentral.com/book/web.html</s:content>
        <s:mTime>2007-03-21 00:20:59.0</s:mTime>
        <s:cTime>2007-03-21 00:20:59.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/ruby on rails'/>
                <rdf:li rdf:resource='#john'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on debian sarge'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/distros/debian'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/rimuhosting ssh access'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/memory troubleshooting'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin+on+debian+sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/load balancing and failover'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/installing and using mod_fastcgi'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>
