---
title: "Comment by mohammad khosravi on \"How To Deploy NodeJS Apps With PM2 & NGINX In Cluster Mode On Production\" | Hashnode"
description: "hi, thank you for this article, its very helpful. but i have a problem and i search for it but got no answer. i have a nextjs project and i deploy it with pm2 a"
url: "https://hashnode.com/posts/how-to-deploy-nodejs-apps-with-pm2-nginx-in-cluster-mode-on-production/5fcb13742e4db7780e482ce4/comment/63da36c0672b295ef3b4268d"
---

[Discussion](https://hashnode.com/posts/how-to-deploy-nodejs-apps-with-pm2-nginx-in-cluster-mode-on-production/5fcb13742e4db7780e482ce4)

Comment [How To Deploy NodeJS Apps With PM2 & NGINX In Cluster Mode On Production](https://hashnode.com/posts/how-to-deploy-nodejs-apps-with-pm2-nginx-in-cluster-mode-on-production/5fcb13742e4db7780e482ce4)

[mohammad khosravi](https://hashnode.com/@smkh)

[Feb 1, 2023](https://hashnode.com/posts/how-to-deploy-nodejs-apps-with-pm2-nginx-in-cluster-mode-on-production/5fcb13742e4db7780e482ce4/comment/63da36c0672b295ef3b4268d)

hi, thank you for this article, its very helpful. but i have a problem and i search for it but got no answer. i have a nextjs project and i deploy it with pm2 and nginx. it works properly and i set max instances for my project in cluster mode. but when i stop the first instance the website is going down and get 502 nginx error and other instances not working until i restart the other instance. why this happens? note: i use this command for start my project with pm2: pm2 start npm --name myproject -i -1 -- start

with regards
