Saturday, November 23, 2013

Deploy Ruby On Rails Application with Apache server using Phusion Passenger gem

Know about Phusion Passenger:
Phusion Passenger is an application server which can be integrated into web server like Apache and Ngnix web servers.

Requirement:

Ruby (If not then install it)
Rails (If not then do gem install rails -v 3.2.13 )

Follow below steps to deploy:

Step 1: Install Passenger gem
gem install passenger 
Step 2: Install Apache module for Passenger
passenger-install-apache2-module
After completing this command it will provide you code with 3 line for add in your Apache configuration file which is located in 
/etc/httpd/conf/httpd.conf

In my installation Passenger gem's version 4.0.25 is there so it looks like this:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.25/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.25
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p448/ruby
Step 3: Restart Apache Server
service httpd restart
Step 4 : Set Apache VirtualHost
<VirtualHost *:80>
    ServerName www.sachingevariya.com
    DocumentRoot /app-path/public
    <Directory /app-path/public>
        AllowOverride all
        Options -MultiViews
    </Directory>
</VirtualHost>
IF you want to check log for debug(error check) with passenger then:

1.) Go inside:
     cd /var/log/httpd
2.) then do it:
     tail -n 300 error_log | more

1 comment:

  1. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles ruby on rails training

    ReplyDelete