Unitech / Unitech/pm2

Several PM2 web apps with NGINX

Open
#5,365 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

I have several NodeJS web apps running in localhost in different ports through PM2. I then use NGINX as web server.

I read the PM2/Nginx production setup for NGINX configuration

upstream my_nodejs_upstream {
    server 127.0.0.1:3001;
    keepalive 64;
}

server {
    listen 443 ssl;
    
    server_name www.my-website.com;
    ssl_certificate_key /etc/ssl/main.key;
    ssl_certificate     /etc/ssl/main.crt;
   
    location / {
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    	proxy_set_header Host $http_host;
        
    	proxy_http_version 1.1;
    	proxy_set_header Upgrade $http_upgrade;
    	proxy_set_header Connection "upgrade";
        
    	proxy_pass http://my_nodejs_upstream/;
    	proxy_redirect off;
    	proxy_read_timeout 240s;
    }
}

My questions are:

A) is there any further optimizations I can do in NGINX considering I have several NodeJS web apps running under PM2?

B) Can I load balance between different ports for the same app, considering the app runs in different instances?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked PM2/Nginx production setup and the supplied NGINX upstream and server configuration. Determine whether the documentation should address optimization for several PM2 apps and load balancing multiple instances of the same app; done means providing clear, supported guidance for both questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
nginx, node.js
Domain
devops
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.