Deploy rails application in apache2 server using passenger

Tuesday, October 29, 2013

In ubuntu create virtual server and deploy rails application using passenger and apache server

Step 1:
Make sure apache is installed and it work on ubuntu properly. Check it in browser.


It should display  "It Works!"

Step 2:
Install passenger gem on ubuntu

$ gem install passenger

Step 3:
Install passenger apache module.

$ sudo passenger-install-apache2-module

Step 4:
We need to install require module for apache passenger

Step 5:
After installation we need to add the passenger ruby modules at apache config file.

$ sudo subl /etc/apache2/apache2.conf

At last you need to add this lines

LoadModule passenger_module /home/kannan/.rvm/gems/ruby-1.9.3-p374/gems/passenger-4.0.21/buildout/apache2/
PassengerRoot /home/kannan/.rvm/gems/ruby-1.9.3-p374/gems/passenger-4.0.21
PassengerDefaultRuby /home/kannan/.rvm/wrappers/ruby-1.9.3-p374/ruby

Step 6:
Create default sites enabled file and pase this code

$ sudo touch /etc/apache2/sites-enabled/railsproject.local

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

eg. somewhere-> /var/www/railsproject


   NameVirtualHost *:80
   <VirtualHost *:80>
      ServerName www.railsproject.local
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public   
      <Directory /somewhere/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews

Step 7:
Open hosts file and add the local ip of your application

$ subl /etc/hosts

Add last you need to add    railsproject.local

Step 8:
Restart your apache2 server

$ sudo service apache2 restart

Step 9:
check your virtula hosted project domain




  1. This blog having the details of Processes running. The way of running is explained clearly. The content quality is really great. The full document is entirely amazing. Thank you very much for this blog.
    SEO Company in India
    Digital Marketing Company in India

  2. Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge.
    Sat Coaching Chennai

  3. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
    Digital Marketing Company in Chennai

  4. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Personal Installment Loans
    Title Car loan
    Cash Advance Loan