Updating Ghost broke my blog

April 27, 2015 3.9k views
Nginx Ghost One-Click Install Apps

I’ve read a few posts on this subject, but I just updated my ghost using the DO-specific guide and it came up with a 502 error.
I followed a couple of questions on how and why this is happening, including debugging it by turning nginx off and then running npm start –production inside my ghost folder. This worked fine, I then restarted nginx and ran the command again and my blog came back up.
Problem is that naturally, this will stop working when I close down that terminal window/want to do anything else in the same terminal window, but when I close it and use “service ghost start” or “service ghost restart” I get a 502 bad gateway again.
Help?
Should note my original install was a DO one-click.

2 Answers

What port is Ghost running on? Nginx listens for it on 2368.

The Upstart init script used on the “one-click” droplet essentially just runs npm start --production Here’s a copy of if:

description "Ghost: Just a blogging platform"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectedly trigger a respawn
respawn

setuid ghost
setgid ghost
env NODE_ENV=production
chdir /var/www/ghost

exec /usr/local/bin/npm start --production

pre-stop exec /usr/local/bin/npm stop --production

Are there any errors in /var/log/upstart/ghost.log ?

  • This seems to be the recurring one:

    ghost@0.6.2 start /var/www/ghost
    > node index
    
    ^[[31mERROR: Unable to access Ghost's content path:^[[0m
      EACCES, permission denied '/var/www/ghost/content/apps/5d07aed7ead1d4bf'
    
    ^[[32mCheck that the content path exists and file system permissions are correct
    

    So I need to change the permissions on ghost I guess?

  • @charlottegodley Yep. Looks like the permissions got changed when downloading the new release. Running chown -R ghost:ghost /var/www/ghost should clear that up. Let us know if you still have issues!

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!