How to Backup your Ghost Blog
With a default install of Ghost, your blog content is saved in a database located at
/content/data/ghost.db. Also in your
content directory, there is an
images directory which contains any images which have been uploaded.
There are two ways currently to back up your Ghost blog. One is through the admin interface and the other is by backing up the entire Ghost folder on your server.
If you use the admin interface, it will give you a file with all of your blog's posts and pages in it. Unfortunately, for now this will not back up your images, just the written content. While that is usually the most important information, to back everything up, you can use the command line.
If you are hosting on a platform like Ghost(Pro) where you don't have access to the file structure, you can still backup via the Admin interface. For the images, you can probably email them asking for them to have as a backup or ask what their backup solution is for your stuff.
To backup your blog using the admin interface:
- Navigate to the labs section in your Ghost admin (
- Click on the 'Export' button at the top and download the file.
- This file contains all the posts and page content. Keep this file as the backup.
- If you need to restore the data, on the same page, upload the file and click on the "Import" button.
To back up using the command line, you need to be using a host that provides you access to the core files of Ghost. This means that services like Ghost(Pro), or ASmallOrange, or shared hosting platforms will not be able to do this (although I'm sure if you just ask they can provide you a full backup).
- SSH into the server where your Ghost blog is living
- Stop Ghost from running
service ghost stop(on DigitalOcean)
- Move to where your Ghost folder lives
cd /var/www(for most platforms Ghost lives here)
- Copy Ghost to a backup folder
sudo cp -r ./ghost ./ghost_backup
- Start Ghost back up again
service ghost start(on DigitalOcean)
- To restore from a backup, stop Ghost, move the entire
ghost_backupfolder back into where it should be, make sure the permissions are correct (aka owned by the Ghost user), and start Ghost back up again.
That will make a copy of your entire Ghost directory so if something happens, you have a backup. It may also be a good idea for you to move that folder completely off the server so if the whole server disappears you have it backed up elsewhere in case the whole server gets corrupted.
Good luck and let us know if you have any questions!