Phusion Passenger is one of the easiest Rails and Rack environments to set up and configure with Apache2. With my bootstrapping scripts, the ability to establish a Virtual machine image and have a working Rails application on it in minutes is a reality. Here is how I do it.
Begin by Bootstrapping Ubuntu.
The next step is to run the script for installing Passenger. The standard passenger install against the standard Ruby 1.8.7 package managed libraries are installed with the following:
(assuming you’ve downloaded the bootstrap scripts and are in the ~/bootstrap-scripts/ubuntu/intrepid folder already, execute the following script:
./bootstrap-passenger-std.sh
Passenger’s install prompts you two or three times. Simply press and ignore the additional configuration instructions (the bootstrap script carries out these instructions for you).
cd /var/www sudo mkdir rails cd rails sudo rails demo cd .. chown -R www-data:www-data rails
Apache2 on Ubuntu makes it fairly straightforward to set up a provider for the Rails application, simply create the following in /etc/apache2/sites-available/demo:
<VirtualHost *:80> ServerName localhost DocumentRoot /var/www/rails/demo/public </VirtualHost>
And then enable the site:
sudo a2ensite demo sudo /etc/init.d/apache2 reload
If all goes well, you should then be able to browse to http://localhost and see the rails greet page. Your system will look something like this:
OS: 2.6.27-7-server x86_64 GNU/Linux Apache: Server version: Apache/2.2.9 (Ubuntu) Passenger: 2.0.6 Ruby: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] Rubygems: 1.3.1 gems: - actionmailer (2.2.2) - actionpack (2.2.2) - activerecord (2.2.2) - activeresource (2.2.2) - activesupport (2.2.2) - fastthread (1.0.1) - passenger (2.0.6) - plist (3.0.0) - rack (0.9.1) - rails (2.2.2) - rake (0.8.3)