Question

502 Bad Gateway post droplet reboot due to physical node issue

Hi,

DOCN rebooted by droplet and now I am getting a 502 Bad Gateway error (nginx/1.18.0 (Ubuntu)). Please could someone assist what I need to do. I tried running “pm2 restart app.js” in console but getting [PM2][ERROR] Process or Namespace app.js not found.

This is really frustrating as my service is down because of Digital Ocean issue - have raised a support ticket.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
February 28, 2024

Heya @yuriwhale,

When you do

pm2 list

Do you see your application? Try to start that one, otherwise go to yur App’s folder where the app.js is and try to start the pm2 process from there.

Addtionally, check pm2 error log, you can either do

pm2 list IDNUMBEROFPROCCESS

or go to pm2 logs and check the error log for more detailed response.

alexdo
Site Moderator
Site Moderator badge
February 28, 2024

Hey @yuriwhale,

First you can check that pm2 is running. Run pm2 status to see if your application is listed there. If it’s not listed, you’ll need to start it again.

If your application is not listed in the PM2 status, you can start it by running pm2 start app.js. Make sure you navigate to the directory where your app.js file is located before running this command.

After starting your application, monitor the logs to see if there are any errors. You can do this by running pm2 logs.

Another thing is to check if NGINX is running and if not to restart it.

  1. systemctl status nginx

If NGINX is down, then you can restart it.

  1. systemctl restart nginx

Hope that helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel