Last night I upgraded my blog to the latest version of ghost with the help of Digital Ocean's tutorial.
Upgrading Ghost (updated as of Ghost 0.4)
- First you'll need to find out the URL of the latest Ghost version. It should be something like http://ghost.org/zip/ghost-latest.zip.
- Once you've got the URL for the latest version, in your Droplet console type
cd /var/www/
to change directory to where the Ghost codebase lives.- Next, type
wget http://ghost.org/zip/ghost-latest.zip
- Remove the old core directory by typing
rm -rf ghost/core
- Unzip the archive with
unzip -uo ghost-latest.zip -d ghost
- Make sure all of the files have the right permissions with
chown -R ghost:ghost ghost/*
- Change into your Ghost directory with cd ghost, then run
npm install --production
to get any new dependencies- Finally, restart Ghost so that the changes take effect using
service ghost restart
From the terminal this seemed to work as expected; however, when I tried to access the site via the browser I was served with a 502 Error from nginx.
First things first, check your error logs for nginx.
Open to /var/log/nginx/error.log
and scroll to the bottom of the file, you should one or more errors.
Likely causes
- When you updated and ran
npm install --production
something failed - You forgot to update your nginx configuration to point to the blog
- You updated the nginx configuration but not the ghost configuration for your domain name settings
Fixes
First thing to check is that your dependencies have installed correctly during the update.
- open the console and
cd /var/www/ghost
- run
npm start --production
- watch for dependency errors
You will probably see something like run 'npm install sqlite3 --save'
and an error stating that npm couldn't find one or more dependencies. Run the commands as instructed and then try and start npm again, rinse and repeat until you've cleared the dependency errors.
Next check that your nginx configurations are correct. Open /etc/nginx/sites-enabled/ghost
and /etc/nginx/sites-available/ghost
and check that your server_name
is correct. The server_name config will be inside the server block.
server {
server_name joewoodward.me;
}
Last you need to validate your ghost url configuration. Open /var/www/ghost/config.js
and look for the production
config block. Inside the production
block you will see the url
attribute, this should match your domain name. e.g.
production: {
url: 'http://joewoodward.me'
}
Once you've validated all of your configs you can restart ghost by running service ghost restart