Install the passenger gem in ruby:
[atejeda@backorg ~]$ sudo gem install passenger
Install the passenger apache module:
[atejeda@backorg ~]$ sudo passenger-install-apache2-module
Add this lines to httpd.conf:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/bin/ruby
Add a virtual host in httpd.conf (example):
<virtualhost *:80 >
ServerName atejeda.backorg.com
DocumentRoot /var/www/html
# RailsEnv development
# RailsBaseURI /atejeda
<Directory /var/www/html>
# AllowOverride all
# Options -MultiViews
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
RailsBaseURI /atejeda
<Directory /var/www/html/atejeda>
Options -MultiViews
</Directory>
</virtualhost>
Create the symbolic link
[atejeda@backorg ~]$ ln -s /home/atejeda/www/blogs/public /var/www/html/blog
Restart the service (graceful o full restart):
[atejeda@backorg ~]$ sudo service httpd graceful
or
[atejeda@backorg ~]$ sudo service httpd restart
An important note: This only works when the ruby app is in the production enviroment !!.
And config the SELinux to Permissive or Disable, how to to this: http://www.crypt.gen.nz/selinux/disable_selinux.html
More info can be found: http://www.modrails.com/documentation/Users%20guide%20Apache.html
Symlink problem fix: http://www.zsoltmolnar.hu/blog/tech/2006/07/symbolic-link-not-allowed-or-link.html
A good syadmin, always check the log’s file, check yours in case of any errors.