502 Bad Gateway after Ghost upgrade

my blog was working fine and today I decided to upgrade the Ghost to latest version and I followed the first solution given on this page

But I actually forget to stop the ghost before to run upgrade command. It upgraded but now my site is not working. and Digital Ocean support is unable to help me.

This is the log of /var/log/nginx/error.log

Output of some more command which Digital ocean support asked me to share

Show comments

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I get this error a lot. It’s almost always because of some half-installed-but-broken-from-previous-try npm dependency, and npm is too dumb to know it’s broken. And the ghost json doesn’t have “unsafe-perm” set so that is really the root issue…

Anyway, this is what I tend to do in the ghost directory: rm -rf node_modules && npm cache clean npm install --production --unsafe-perm chown -R ghost:ghost * service ghost restart

Had the same problem. It turns out that I forgot to run npm install --production after copying the files.

A 502 error will usually indicate that the nginx server is not able to reach the upstream ghost process. Restarting these services will usually clear this up unless there are other issues causing ghost not to start:

sudo service ghost restart
sudo service nginx restart