Moving a self-hosted Ghost Blog between Servers

Page Header

I don’t like paying for stuff. I must be an annoying customer. I tend to find a great deal on cloud servers (by great deal I mean free), use that until it runs out and then hunt down another one. For a while I was using to host this blog, then I was using the free trial period with AWS, then I utilised a student pack thing from Github (yay for still having Uni email) to get $100 credits with DigitalOcean, and now that that has run out I’ve moved over to Azure.

Well, this time I’ve paid for the Azure hosting, but not without a great discount first.

The fun part though comes in trying to migrate my blog between sites. Ghost comes with a great export tool (see Settings > Labs > Export), but that doesn’t cover any images you’ve uploaded. Nor does it cover any code injections you’ve added, like the Disqus comments I’ve put on these posts (yes, there is a code injection part in the Ghost settings, but that’s only for global injections like Google Analytics).

So this is a rough guide to what I do to move between hosts. It’s not automated, because it typically only happens once a year and only takes me about 15 minutes, but hopefully it helps someone in the same situation:

  1. Use the export tool built-in to the admin portal of the blog (as mentioned earlier) to export the whole blog.
  2. SSH to the existing server.
  3. Copy the whole contents of /path/to/ghost/content/images/ to /tmp/migration
  4. Use SCP to transfer the /tmp/migration folder over to the same location on the new server.
  5. Copy any code injections you have added.
  6. Install the new Ghost instance in exactly the same way as I did on the old host (you documented the process, right?).
  7. Go through the web-based setup of the new instance so you can get to the Admin portal.
  8. Import the export from before into the new instance.
  9. Move the contents of /tmp/migration into /path/to/ghost/content/images/.
  10. Re-apply your old code injections into the new instance.
  11. Update DNS, CloudFlare, migrate SSL certificates (if necessary), etc. to finish up.

And if you did it right, you’re new site should happily appear and you can shut down the old one.