VPS Migration Self-hosted Ghost Instance

I recently migrated my Ghost site between different VPS providers. Here is my method for my reference or in case you try to find a guide for it.

First, let's start on the initial VPS we'd like to back up. There is 2 thing we going to back up, the Ghost data (content, members, images, site setting, theme, etc.) and database.

Old VPS

Initially, we need access to the server. Then head over to the Ghost installation folder and make a backup.

Ghost Data Backup

cd /var/www/sitename
ghost backup
scp ./backup-* user@new-vps-ip:/home/user/

Database Backup

mysqldump -u root -p sitename_prod > sitename_prod.sql
scp ./sitename_prod.sql user@new-vps-ip:/home/user/

Adjust accordingly for both data and database scp transfer processes.

New VPS

Within the new VPS, just simply install Ghost just like what their installation guide provides (https://ghost.org/docs/install/ubuntu/).

On the installation process skip the SSL configuration parts since we will configure it later and don't run it yet. After it is finished, take a note at config.production.json for the auto-generated database information.

Restore Database and Ghost Data

mysql -u sitedbname -p sitename_prod < /home/user/sitename_prod.sql 
unzip /home/user/backup-* -d /var/www/sitename/content/
sudo chown -R ghost:ghost ./content

Now let's point the DNS server from the former VPS IP address into a new one. What a while for the propagation

ghost setup ssl

If the command running unsuccessfully, the DNS might have not propagated, wait a little longer then rerun the command. After it is done, start the Ghost site, now, the site should be hosted on the new VPS.


To wrap it up, recheck the new site if all the site functionality works just fine.