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.
If you are going to use eRuby with a virtual host you will need to enable cgi programs.
On Debian based distros the default cgi-bin is here, but you may need to insert this into your virtual host directive
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
On RedHat/Fedora based distros it looks like this
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
Then copy this script into a file called eruby.sh or similar.
#!/bin/bash
apt-get install -y erubyif [ -e /etc/redhat-release ]; then
touch /etc/httpd/conf.d/eruby.conf
echo "Action application/x-httpd-eruby /cgi-bin/eruby" > /etc/httpd/conf.d/eruby.conf
fiif [ -e /etc/debian-release ]; then
touch /etc/apache2/conf.d/eruby.conf
echo "Action application/x-httpd-eruby /cgi-bin/eruby" > /etc/apache2/conf.d/eruby.conf
fiecho "application/x-httpd-eruby rhtml" >> /etc/mime.typesif [ -e /etc/debian-release ]; then
ln -s $(which eruby) /usr/lib/cgi-bin/eruby
a2enmod actions
/etc/init.d/apache2 restart
echo '<% puts "Hello World!" %>' > /var/www/test.rhtml
fi# afaik the actions module is enabled on fedora
if [ -e /etc/redhat-release ]; then
ln -s $(which eruby) /var/www/cgi-bin/eruby
echo '<% puts "Hello World!" %>' > /var/www/html/test.rhtml
fi# Restart Apacheif [ -e /etc/debian-release ]; then
/etc/init.d/apache2 restart
fiif [ -e /etc/redhat-release ]; then
/etc/init.d/httpd restart
fi
Now browse to
http://yourdomain/test.rhtml and see that it works.
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:
http://wiki.modruby.net/en/?InstallGuideThis script was suggested by what I read on this page:
http://www.rubycentral.com/book/web.html