Re: How to serve 2 Rails instances through same website using Passenger & Nginx

53 views
Skip to first unread message

nexar

unread,
May 2, 2017, 11:41:53 AM5/2/17
to Phusion Passenger Discussions
Thanks Camden.  I'll read up on the passenger_ruby config.  I'm also marking this as complete for the moment.  Does passenger ever need any info about Rails anywhere?


On Tuesday, 2 May 2017 14:19:38 UTC+1, Camden Narzt wrote:
You can put a passenger_ruby config in the same location block as the passenger_base_uri option.

On Tuesday, May 2, 2017 at 3:25:15 AM UTC-6, nexar wrote:
Camden many thanks for your prompt response.  It was a Bank Holiday in the UK hence the silence at my end.  Yes that does look like what I want.  However I have another question please.

Since I intend to use Rails 5 I'll also be using a later Ruby version than 1.9.  How do I tell Passenger which ruby version to use for each app please?  The example in the docs appears to expect that both the apps will be using the same versions of Ruby at least and in even Rails. 

Thanks


On Monday, 1 May 2017 14:36:20 UTC+1, Camden Narzt wrote:
What you want is the passenger_base_uri config option https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_base_uri

On Saturday, April 29, 2017 at 3:54:11 AM UTC-6, nexar wrote:
I've inherited a fully functioning production site running Nginx, Passenger, Rails 3.2, Ruby 1.9 (I believe), Mysql 5.7 & JS frontend on Ubuntu 16.04.  The client wants to add major new functionality and I would rather provide that using Rails 5.  However this new functionality is part and parcel of the current system from the client's point of view.  i.e. the client wants to be able to access this functionality by just clicking on a menu option within the existing site.

One suggestion I've had is that I set up nginx using reverse proxy to access the diferent Rails projects.  I have used something similar on my development machine but there I've used separate Passenger Standalone instances running on different ports and of course the website names were different too.  

What I want to achieve this time is: 

www.clientsite.com - takes me to the old Rails 3.2 site
www.clientsite.com/newfunc - takes me to the Rails 5 site.  i.e. the domain is the same but just by adding /newfunc I should be able to serve up the Rails 5 site.  Since I will only be calling www.clientsite.com/newfunc from within JS it will appear 'seamless' to the client.

My questions are:

1.  Can this be done at all?

2.  If it can then do I need to run Passenger Standalone?

3.  How would I configure Passenger/Passenger Standalone and Nginx.

All help gratefully received with thanks.

Camden Narzt

unread,
May 2, 2017, 12:28:03 PM5/2/17
to Phusion Passenger Discussions
Passenger doesn't need to know about rails, though in some cases (smart spawning method) you may need your app to be aware of passenger and reopen any extra DB/process connections beyond the default activerecord.
Reply all
Reply to author
Forward
0 new messages