Wednesday, January 1, 2014

How to: Ruby on Rails + Ubuntu + Apache with Passenger

Now you can use gem to install Rails:

sudo gem install rails

Install Phusion Passenger (an Apache module that lets you run Rails apps easily):

sudo gem install passenger

sudo passenger-install-apache2-module

The passenger-install-apache2-module script will guide you through what you need to do to get Passenger working. It should tell you to copy these lines into your /etc/apache2/apache2.conf:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/

PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2

PassengerRuby /usr/bin/ruby1.8

Create a file in /etc/apache2/sites-available/ for your site (something like '') and insert this:
<VirtualHost *:80>
        alias /iapps /home/taind/svn/branch/irorio/irorio-api/public
        DocumentRoot /home/taind/svn/branch/irorio/irorio
        DirectoryIndex index.php
        SetEnv APPLICATION_ENV development
        <Directory /home/taind/svn/branch/irorio/irori>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        <Location /iapps>
                PassengerBaseURI /iapps
                PassengerAppRoot /home/taind/svn/branch/irorio/irorio-api
        <Directory /home/taind/svn/branch/irorio/irorio-api/public>
                Options -MultiViews
                Allow from all
        RailsEnv development
        #RailsBaseURI /iapps