Lets assume we have two apps

1. with ruby 1.9.3 (application1)

2. with ruby 2.1.0 (application2)

Basic Apache Configuration

LoadModule passenger_module /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
PassengerRoot /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41
PassengerRuby /home/jony/.rvm/gems/ruby-1.9.3-p0/wrappers/ruby

<VirtualHost *:80>
ServerName localhost
DocumentRoot /path_to_application1/public
</VirtualHost>

Basic Nginx Configuration

LoadModule passenger_module /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
PassengerRoot /home/jony/.rvm/gems/ruby-1.9.3-p0/gems/passenger-4.0.41
PassengerRuby /home/jony/.rvm/gems/ruby-1.9.3-p0/wrappers/ruby

server {
listen 80;
server_name localhost;
root /path_to_application1/public;
passenger_enabled on;
}

Now lets setup application2 with ruby 2.1.0

Setup 2.1.0 and run passenger standalone

$ rvm install ruby-2.1.0
$ rvm use 2.1.0
$ cd /path_to_application2/
$ passenger start -a 127.0.0.1 -p <port number> -d

Updated Apache Configuration for Application2

<VirtualHost *:80>
ServerName localhost
DocumentRoot /path_to_application2/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:<port number>/      #port number should be same on which you have run the passenger
ProxyPassReverse / http://127.0.0.1:<port number>/
</VirtualHost>

Updated Nginx Configuration for Application2

server {
listen 80;
server_name localhost;
root /path_to_application2/public;
location / {
proxy_pass http://127.0.0.1:<port number>;
proxy_set_header Host $host;
}
}

Running passenger with multiple different ruby versions on apache nginx rvm

2 thoughts on “Running passenger with multiple different ruby versions on apache nginx rvm

  • July 14, 2014 at 9:34 am
    Permalink

    It’s hard to find your website in google. I found it on 15
    spot, you should build quality backlinks , it will help you to get more visitors.
    I know how to help you, just search in google – k2
    seo tips

    Reply
  • August 28, 2014 at 1:27 pm
    Permalink

    I read a lot of interesting articles here. Probably you spend a lot of time writing,
    i know how to save you a lot of work, there is an online tool that creates
    unique, google friendly articles in minutes, just
    type in google – laranitas free content source

    Reply

Leave a Reply

Your email address will not be published.