title: Passenger sub uri's
body: <p>The Phusion Passenger instructions are great in most regards.  They have far better-than-average install guides on setting up NGINX, the passenger app, testing python, and so forth. The instructions on setting up several separate apps on a single server are, well, deficient. The main reason I adopted Passenger is the ability to host several apps. </p>
  
  <p>I followed the Phusion Passenger instructions for setting up NGINX server with a sub URI (<a href="https://www.phusionpassenger.com/library/deploy/nginx/deploy/python/" rel="nofollow noreferrer">https://www.phusionpassenger.com/library/deploy/nginx/deploy/python/</a>). I thought this would allow me to run separate apps with different sub folders.  I have several python applications in <code>/var/www</code>, like so:</p>
  
  <pre><code>/var/www/dashboard
  /var/www/peniso
  </code></pre>
  
  <p>I have a Python virtual environment for each one, in the separate subfolders venv.  Each one works individually.  But how to make all available at once? The problem I see is that no matter which sub URI is used, the same app runs.</p>
  
  <p>Here's what I tried in my /etc/nginx/sites-enable/dashboard.conf file:</p>
  
  <pre><code>server {
      listen 80;
      server_name testapp.myexample.com;
  
      # Tell Nginx and Passenger where your app's 'public' directory is
      root /var/www/dashboard/public;
  
      passenger_app_type wsgi;
      passenger_startup_file passenger_wsgi.py;
  
      # Turn on Passenger
      passenger_enabled on;
      passenger_python /var/www/dashboard/venv/bin/python3.7;
  
      location ~ ^/mydash(/.*|$) {
          alias /var/www/dashboard/public$1;
          passenger_base_uri /mydash;
          passenger_app_root /var/www/dashboard;
          passenger_document_root /var/www/dashboard/public;
          passenger_enabled on;
          passenger_python /var/www/dashboard/venv/bin/python3.7;
     }
  
  
     location ~ ^/efergy(/.*|$) {
          alias /var/www/peniso/public$1;
          passenger_base_uri /efergy;
          passenger_app_root /var/www/peniso;
          passenger_document_root /var/www/peniso/public;
          passenger_enabled on;
          passenger_app_env development;
          passenger_python /var/www/peniso/venv/bin/python3.7;
     }
  }
  </code></pre>
  
  <p>I browse <code>http://testapp.myexample.com/mydash</code> or <code>http://testapp.myexample.com/efergy</code> I see is the same app showing. In the top part, before the sub-sections, I can replace "dashboard" with "peniso" and it changes which 1 app runs. I've flipped the ordering of the folders, also changed the root from one to the other.  Still only one app seems to be available. </p>
  
  <p>How do you configure Passenger to work with several different apps?</p>
  
  <p>Eventually, I need to host some Python and some Node.js apps, once I understand how to get the directories under /var/www to work right.</p>