Thursday, February 11, 2010

Installing Phusion Passenger

Phusion Passenger is an apache modul, it's enable Ruby application work in apache which you can deploying your Rails applications and manage it.

In these intructions i'm used Ubuntu Linux operating system, follow this steps:

open the terminal and type

> sudo gem install passenger
> sudo passenger-install-apache2-module


you would see the wizard installation, follow the instructions step by step :)

now, passenger is installed.

Adding these lines to apache conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9
PassengerRuby /usr/local/bin/ruby



copy and paste in this location

> sudo nano /etc/apache2/apache2.conf

put that at the bottom and save

> sudo apache2ctl -k restart OR sudo /etc/init.d/apache2 restart

restart your apache

adding new IP addresses for every app as you want to add, in this location

> sudo nano /etc/hosts

127.0.0.1       localhost
127.0.1.1       arul-laptop

127.0.0.2       sgm.local

127.0.0.3       extranet.gamestreamer.rails
127.0.0.3       admin.gamestreamer.rails
127.0.0.3       games.gamestreamer.rails
* in this case i'll use the SGM (my project applications) to guide

add a virtual host to your apache congfiguration

> sudo nano /etc/apache2/sites-available/sgm

<VirtualHost 127.0.0.2:80>
ServerName sgm.local
DocumentRoot /home/arul/Documents/41studio-projects/SGM/public
RailsEnv development
RailsBaseURI /
<Directory "/home/arul/Documents/41studio-projects/SGM/public/">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
* add "public" directory of end your app locations

> ls -l /etc/apache2/sites-available

showing the site available now

> ls -l /etc/apache2/sites-enable
showing the site enabled now, you can enabled the site which you must make the simbolic link from sites-available to sites-enable directory in apache configuration

> sudo ln -s  /etc/apache2/sites-available/sgm  /etc/apache2/sites-enable/
you can undo that symlink with "sudo unlink" command

> ls -l /etc/apache2/sites-enable
> sudo /etc/init.d/apache2 restart
now, we have successfully configuration the site

you can check it out, open your browser and point this http://sgm.local (it's mine)

actually, to configure that's have shortcut way.. follow this steps

after you made the virtual host, you can automatically configure with this command and restart your apache webserver :)

> sudo a2ensite sgm
> sudo /etc/init.d/apache2 restart