Monday, 23 July 2012

configuring pushion passanger for rails app

Here are few steps that make you to configure pussion passenger with apache.

Many of the ruby on rails developer runs the application in webrick which comes as a default server with rails framework. But when you are deploying application to server we need to choose a good server as a application server. 

There are many servers that are available for rails application. Here I would like to explain about the  configuring passenger with apache. 

 

Need to install pushion passanger gem

gem install passenger
 
before that need you need to make the correct ruby version. i.e pussion passanger need to be install with appropriate ruby version of the rails application.

i.e if your rails application is using ruby 1.8.7 then.
> rvm use 1.8.7
gem install passenger

passenger-install-apache2-module


After installing, it will ask to add few lines on apache config files as below

The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:

 LoadModule passenger_module /usr/local/rvm/gems/ruby-1.8.7-p358/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
 PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p358/gems/passenger-3.0.13
 PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby

You need to add above lines in apache/httpd.conf file.

In my present sever it was located at 'user/local/apache/config.httpd.conf'

Need to add virtual host on the above configuration file

<VirtualHost 123.45.678:80>
  ServerName myapp.com
  DocumentRoot "/home/umamahesh/myapp/public"
  RailsEnv development
</VirtualHost>



Now you to restart the apache server. 
 
To check all the things given in httpd.conf file was correct run the below command

> /etc/init.d/httpd restart

Next restart the apache server.

Next need to restart the pushion passanger server as below

> in the application directory 
> touch tmp/restart.txt

Now your application with run with pussion passenger.


Thank You,
Uma Mahesh.

No comments:

Post a Comment