Ghost upgrade: 502 Bad Gateway

August 3, 2016 4.1k views
Ghost Nginx

Hi guys,

I just upgraded Ghost and got a 502 Bad Gateway error. I’ve checked my error.log and the error seems to be:

connect() failed (111: Connection refused) while connecting to upstream

Any help would be greatly appreciated!


3 Answers

I had this problem too after doing the usual npm install --production and service ghost restart

rm rf node_modules
npm cache clean
npm install --production --unsafe-perm
npm install knex
chown -R ghost:ghost *
npm start --production

At this stage I got an error saying something about not finding SQLite3. So install SQLite3 module npm install sqlite3 --build-from-source

If it didn’t build, make sure all the dependencies are installed

sudo npm install -g node-gyp
sudo apt-get install build-essential
sudo apt-get install python-software-properties python g++ make 
npm install sqlite3 --build-from-source

Finally restart ghost npm start --production

After doing the update did you attempt a service ghost restart and did this command result in any output?

The above reply by @albertlimca fixes the issue in my droplet for Ghost 0.9.0.


Have another answer? Share your knowledge.