Question

502 Bad Gateway after Ghost upgrade

  • Posted October 8, 2014

my blog http://jitendravyas.com/ was working fine and today I decided to upgrade the Ghost to latest version and I followed the first solution given on this page

http://www.allaboutghost.com/how-to-update-ghost-to-version-0-4/

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 http://pastebin.com/UbQfZVe7

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

http://take.ms/rqCWN http://monosnap.com/image/z4TAuEUKGqZZz1CYz8zQjjwThHBoq0# http://take.ms/368Nv http://take.ms/nxMpP

Subscribe
Share

This comment has been deleted


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.

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

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

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

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