Report this

What is the reason for this report?

502 Bad Gateway after Ghost restart

Posted on December 15, 2014

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.

See http://elliotblackburn.com/

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

I then found https://www.digitalocean.com/community/questions/502-bad-gateway-after-ghost-upgrade?comment=24356 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 - http://pastebin.com/TLNHP5VU



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!

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 know it’s an old thread and I apologize for reviving but this thread just helped me get my ghost app back up and running after restoring a failed upgrade attempt. I’d like to point out that you should “cd” to your ghost installation folder before running npm --start production… like this:

cd /var/www/ghost

This is an example of the ghost installation folder, YMMV.

After CD’ing to it, run the following:

npm start --production

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.

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.

/var/www/ghost/system/files/<yourDomainName>.<extension>.conf
/var/www/ghost/system/files/<yourDomainName>.<extension>-ssl.conf

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.