---
title: "Comment by Node Edge Ops on \"How to Deploy a Node.js App on a Linux VPS: Complete Beginner's Guide\" | Hashnode"
description: "On a bare Linux VPS the durable split is nginx owning 80/443 and one PM2 listen bound on loopback. Let PM2 own cluster fan-out on that single port — listing eve"
url: "https://hashnode.com/posts/how-to-deploy-a-node-js-app-on-a-linux-vps-complete-beginner-s-guide/6a2ab39dc1f86c878d46e228/comment/6aebf95086423f96e4883df1"
---

[Discussion](https://hashnode.com/posts/how-to-deploy-a-node-js-app-on-a-linux-vps-complete-beginner-s-guide/6a2ab39dc1f86c878d46e228)

Comment [How to Deploy a Node.js App on a Linux VPS: Complete Beginner's Guide](https://hashnode.com/posts/how-to-deploy-a-node-js-app-on-a-linux-vps-complete-beginner-s-guide/6a2ab39dc1f86c878d46e228)

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 5](https://hashnode.com/posts/how-to-deploy-a-node-js-app-on-a-linux-vps-complete-beginner-s-guide/6a2ab39dc1f86c878d46e228/comment/6aebf95086423f96e4883df1)

On a bare Linux VPS the durable split is nginx owning 80/443 and one PM2 listen bound on loopback. Let PM2 own cluster fan-out on that single port — listing every worker in an nginx upstream doubles fail surfaces and breaks session affinity when a process drains. Keep proxy\_http\_version 1.1 with Connection cleared so keepalive into Node reuses sockets, and always forward Host, X-Forwarded-For, and X-Forwarded-Proto so Express builds redirects and secure cookies against the public scheme.

After pm2 reload or a cert renew I check three layers in order: pm2 status, a health hit on the private listen, then the same path through the 443 server block. A short 502 window usually means nginx still talked to a draining worker; wait for the new cluster to accept, or tighten max\_fails / fail\_timeout so a half-dead process leaves the pool quickly. Log $upstream\_status beside $request\_time to separate TLS or vhost drift from a Node crash. Publish only 80/443 on the firewall; leave the PM2 port local.
