Running Strapi in production with PM2
Blog post from Strapi
PM2 can keep self-hosted Strapi applications running after SSH disconnects, crashes, and server reboots, with startup available through a custom server.js file, npm or npx commands, or preferably a version-controlled ecosystem configuration using fork mode and a single instance. Cluster mode is cautioned against because concurrent Strapi processes can conflict during schema synchronization and migrations, duplicate cron jobs, and create problems with local uploads and in-memory caches; larger deployments should instead use shared services, controlled migration steps, and separate instances behind a reverse proxy. Sensitive credentials should remain in a protected server-side .env file rather than a committed ecosystem file, while pm2 startup and pm2 save are both required to restore processes after reboot. Updates should install dependencies and build the admin interface before restarting with refreshed environment variables, and deployments needing no downtime require multiple instances and load balancing. PM2 logging, log rotation, status commands, memory limits, and external health checks support maintenance, although recurring memory-triggered restarts should prompt investigation of leaks or resource-heavy operations. For containerized Strapi deployments, Docker or the orchestration platform should manage process restarts directly instead of running PM2 inside the container.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| Secrets Management | 2 | 451 | 99 | 43 | -80% |
| Kubernetes | 1 | 956 | 75 | 30 | -73% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.