Pages

Deploy rails application in apache2 server using passenger

Tuesday, October 29, 2013

Summary:
-------
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.

http://localhost

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/mod_passenger.so
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


  #railsproject.local

   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
      </Directory>
   </VirtualHost>

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

$ subl /etc/hosts

Add last you need to add

127.0.0.1    railsproject.local


Step 8:
-------
Restart your apache2 server

$ sudo service apache2 restart


Step 9:
-------
check your virtula hosted project domain

www.railsproject.local


Rocks!!!!

3 comments:

  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete