502 Bad Gateway after Ghost restart

  • Posted on December 15, 2014
  • BlueHatAsked by BlueHat

I’ve recently been playing around with Ghost as a possible blogging platform and attempted to install a theme I found. I put the files into the ghost/content/themes folder and extracted the zip (that all went just fine). I then went to restart ghost as is suggested on the guide I was following and I’m now getting a 502 error from nginx.


The only command I tried to restart with was sudo service ghost restart.

I then found and attempted to do the same but to nginx and it said it restarted just fine but I’m still getting a 502 error.

Here is a copy of my /var/log/nginx/error.log -

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 ran into the same problem after upgrading ghost.

Make sure the port number configured in your ghost’s config file and the proxy_pass in your ghost site’s nginx configuration files match.

Check the port number in /var/www/ghost/config.production.json matches the proxy_pass port in the nginx config files.


In my case I had to change 2368 to 2369 in the nginx config files to fix the issue.

Make sure you restart your ghost and nginx after you make the changes.

# restart your ghost site
cd /var/www/ghost/
ghost restart 
# restart nginx
sudo systemctl restart nginx

Hope this helps someone.

I am getting similar error after ghost restart and log file suggest: verbose stack Error: ENOENT, open ‘/var/www/package.json’ this persist after cache clean.


By looking at your error.log it looks like you might have a looping problem and haven’t configure your blog url. Open config.js in your root directory and enter your domain name instead of

I would also restart nginx and ghost after that.