By axiom88guru
Hi I have a MERN stack app and it always worked like charm until this morning when we suddenly got a 502 Bad Gateway(without touching anything). I’ve seen another Post on here which is resolved but any of the steps in that post didn’t help me anything at all.
Not sure, how can I find out? Operating system: Ubuntu 18.04
Expected behavior: To work again like before
Actual behavior: A 502 Bad Gateway
Error log from /var/log/nginx/error.log looks like this
2021/09/23 16:34:25 [error] 23460#23460: *11 connect() failed (111: Unknown error) while connecting to upstream, client: x.x.x.x, server:
, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "x.x.x.x"
Would appreciate your help, Thanks
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!
Accepted Answer
Hello,
The error indicates that your Node service is not running so the Nginx service is unable to connect.
What you need to do is to start your Node service. This would depend on your personal setup, but for example if you are using pm2
, you could get a list of the available services with pm2 list
and then you can start your application with pm2 start your_app_name
.
If you do not use pm2
, what I could suggest is running the history
command so that you could see what were the previous commands executed on the server which could point you in the right direction on how the Node services was first setup and started.
Let me know how it goes! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.