Step one: run passenger-install-apache2-module
as root. This will install the passenger module, which is required.
Step two: The passenger-install-apache2-module
script will tell you what to add to httpd.conf. Add it. It should not affect any other applications you are running.
Step three: For each Ruby on Rails or Sinatra app, configure it in Apache. I do this for Sinatra apps:
<VirtualHost *:80>
ServerName hman.flame.org
DocumentRoot /www/hman/current/public
ExpiresDefault "access plus 10 years"
</VirtualHost>
I then have config.ru
in /www/hman/current
which is detected by Passenger automatically.
For Rails apps:
<VirtualHost *:80>
ServerName art.waywardgypsy.com
DocumentRoot /www/waywardgypsy-art/current/public
ExpiresDefault "access plus 10 years"
</VirtualHost>
I then use Capistrano to deploy the Rails application to /www/waywardgypsy-art
.
In both cases, the .../current/public
directory has files which are static in nature such as images, CSS, etc. These are served directly from Apache. Passenger looks into the virtual host's config and checks for Sinatra or Rails, and if it finds the appropriate config file, it will treat it as the appropriate application framework.
Passenger will not affect virtual hosts which do not have a Sinatra config file (config.ru
) or Rails (config/boot.rb
).