title: Is their a best practice to creating multiple applications using node and nginx as a proxy server?
body: <p>I have nginx running as a proxy server along with a couple of node.js applications.  I have nginx port forwarding to each app in distinct ports.  I have one main server file that looks like this in sites-enabled:</p>
  
  <pre><code>server {
      listen 80;
  
      location / {
          proxy_pass http://localhost:8080;
              proxy_http_version 1.1;
              proxy_set_header Connection 'upgrade';
              proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
      }
  
      location /app1 {
          proxy_pass http://localhost:3000;
              proxy_http_version 1.1;
              proxy_set_header Connection 'upgrade';
              proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
      }
      location /app2 {
          proxy_pass http://localhost:5000;
              proxy_http_version 1.1;
              proxy_set_header Connection 'upgrade';
              proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
      }
  }
  </code></pre>
  
  <p>Each app is running the following code in the /var/www/html directory with a port variable assigned to the above ports respectively:</p>
  
  <pre><code>var http = require('http');
  http.createServer(function(req,res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Under Construction\n');
  }).listen(port, '127.0.01');
  </code></pre>
  
  <p>This file doesn't look maintainable if you have a large amount of applications.  What are some other ways to develop this?</p>