Getting Rails up and running on Apache2 on SUSE is takes a little work as at the moment Rails is not part of the the SUSE software updates network. This means you must build Rails (and Ruby if using SuSE < 9.3) and the FastCGI development kit from source.
1. First off it you need Ruby 1.8.2 (or greater) to run Rails. If you have a version less than this you will need to compile and install Ruby from source.
Install GCC, make, the C devel, zlib and zlib-devel packages using Yast.
Download the latest version of Ruby from http://www.ruby-lang.org/
Untar the source file to /usr/local/src, compile and install (as root or sudo):
tar -xzf ruby-1.8.3.tar.gz
cd ruby-1.8.3
./configure
make
make test
make install
ln -s /usr/local/bin/ruby /usr/bin/ruby
2. Install gems (a ruby package manager). Download gems from http://rubyforge.org/projects/rubygems/Untar the source code into /usr/local/src, compile and install (as root or sudo):
tar -xzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
./configure
make
make install
ln -s /usr/local/bin/gem /usr/bin/gem
3. With ruby and gems installed install Rails:gem install rails --include-dependencies
4. With Rails installed create a test project and test the Rails WebBrick server.
5. Using Yast install the mod_fastcgi package for integrating Rails into Apache2.
6. From http://www.fastcgi.com/ download the FastCGI development package. Untar the source into /usr/local/src and compile:
tar -xzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make install
gem install fcgi -- --with-fcgi-dir=/usr/local/
8. Edit /etc/sysconfig/apache2 and in the modules section add fastcgi to the list of modules loaded by Apache when it starts.9. Create a new virtualhost in Apache for your Rails application. Use the following template as an example:
<VirtualHost *:80>
ServerName rails.test.domain
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
DocumentRoot /srv/www/rails/RailsTestProject/public
<Directory /srv/www/rails/RailsTestProject/public>
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>