Apache and Passenger (mod rails)
Hate deployment via FastCGI? You're not alone. But guess what, Passenger supports Rack; and this book tells you how to get it all going.
You can find additional documentation at the official modrails website.
The easiest way to get started with Passenger is via the gem.
First you will need to have Apache installed, then you can move onto installing passenger and the apache passenger module.
You have a number of options when installing phusion passenger, however the gem is likely the easiest way to get started.
gem install passenger
Once you've got that installed you can build the passenger apache module.
Follow the instructions given by the installer.
Deploying your app
Passenger lets you easily deploy Sinatra apps through the Rack interface.
There are some assumptions made about your application, however, particularly
public sub-directories of your application.
In order to fit these prerequisites, simply make sure you have the following setup:
mkdir public mkdir tmp config.ru
The public directory is for serving static files and tmp directory is for the
restart.txt application restart mechanism.
config.ru is where you will
place your rackup configuration.
Once you have these directories in place, you can setup your applications
require 'rubygems' require 'sinatra' require 'app.rb' run Sinatra::Application
Next thing you'll have to do is setup the Apache Virtual Host for your app.
<VirtualHost *:80> ServerName www.yourapplication.com DocumentRoot /path/to/app/public <Directory /path/to/app/public> Allow from all Options -MultiViews </Directory> </VirtualHost>
That should just about do it for your basic apache and passenger configuration. For more specific information please visit the official modrails documentation.
A note about restarting the server
Once you've got everything configured it's time to restart Apache.
On most debian-based systems you should be able to:
sudo apache2ctl stop # then sudo apache2ctl start
To restart Apache. Check the link above for more detailed information.
In order to restart the Passenger application, all you need to do is run this simple command for your application root: