Question

502 Bad Gateway shows each couple of weeks and requires a manual reboot

For the last 6 months I’ve been running Ghost with Node.js here on DigitalOcean. As I’m not very good with all the technical server related topics I always use the forum to find most of the questions and problems that I have. Nevertheless something has been happening each 2 weeks or so with my Ghost blog. It works perfectly fine for a couple of weeks and then it shows:

<^>502 Bad Gateway

nginx/1.4.6 (Ubuntu) <^>

I then have to manually go to console access and type then the service ghost-XXXX restart to get it back to normal. Is there anyway to change this or to create each week create an automatic action to run this code at least so I don’t have to do it manually?

Subscribe
Share

The most common reason for services to suddenly stop on a droplet (especially a small one) is those services running out of available memory. I would recommend setting up a swap file which should resolve this issue and seeing if the 502 errors you have been encountering continue. This tutorial will guide you in the process.

Thanks ryanpq! I followed the guide and will keep the post updated in case it works.


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

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.

This question was answered by @ryanpq:

The most common reason for services to suddenly stop on a droplet (especially a small one) is those services running out of available memory. I would recommend setting up a swap file which should resolve this issue and seeing if the 502 errors you have been encountering continue. This tutorial will guide you in the process.

View the original comment