ruby-on-rails-3passengerrack

Phusion Passenger configuration: How passenger_min_instances affects the sub-URI setup


We are setting up multiple sub-URI (3 of them) in passenger config. We want to ensure that for each sub-uri, we have at least one instance running all the time.

How can we use the passenger_min_instances flag to do that? If I assign this flag to equal 3, is this right? Does it mean there are 3 instances for each sub-uri instance running ALL THE TIME after first visit to the server?

Here is the setup in nginx server block:

server {
       listen 80;
       server_name 176.95.25.193;
       root /var/www;
       passenger_enabled on;
       rails_env production;
       passenger_base_uri /nbhy;
       passenger_base_uri /bt;
       passenger_base_uri /byop;
       passenger_min_instances 2;
       }

Solution

  • You can put configuration for a specific base URI in a location block. Like this:

    location ~ ^/nbhy(/.*|$) {
        ...
        passenger_min_instances 2;
    }
    location ~ ^/bt(/.*|$) {
        ...
        passenger_min_instances 3;
    }