Node.js in Production
Running `node server.js` isn't enough for production. You need restart capabilities and log management.
Installing PM2
bash
npm install -g pm2Cluster Mode
Node.js is single-threaded. PM2 can spawn multiple instances to utilize all CPU cores.
bash
pm2 start app.js -i maxPersistence
Make sure apps start on boot:
bash
pm2 save
pm2 startupPage changelog
Last updated
- 2024-04-12—Initial or baseline update for this page.
Related articles
Deployment
Integrations & Plugins — Connect Your Stack
Patterns for integrating monitoring, auth, storage, CI/CD, and webhooks across your services.
Deployment
Deploying Next.js App Router on Cloud VPS
A comprehensive guide to hosting Next.js applications using Node.js, PM2, and Nginx reverse proxy architecture.
Deployment
Deploying Django with Gunicorn & Nginx
Production-ready Python deployment using Gunicorn as the WSGI server and Nginx as the reverse proxy.
Deployment
Self-Hosted GitLab CE Deployment
Take control of your DevOps pipeline by hosting your own GitLab instance on a cloud VPS.
Deployment
Deploying Strapi Headless CMS
Setting up Strapi v4 with a PostgreSQL database for a robust content API.
Deployment
Self-Hosting a PaaS with Coolify
An open-source, self-hosted alternative to Heroku/Vercel for deploying your apps easily.
Was this page helpful?