I have two droplets, D1 & D2. D1 has one wordpress blog hosted on it while D2 has 3 blogs hosted on it. Both D1 & D2 have LEMP stack. I want to move the blog hosted on D1 to D2. Could someone please tell me how to go about it? I am pretty new to Digital Ocean and Linux.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi @anshuldixit
Since I don’t know how much you know or tools you have available, I’ll try to list most.
First, you need to stop using (meaning updating/editing D1’s WP). Then I would highly recommend that you take a snapshot of both D1 and D2 via the DigitalOcean control panel, so you can revert completely in case of total failure.
Then let’s take a backup of the WordPress database of D1. If you have phpMyAdmin, then use that, otherwise I would recommend that you use https://www.adminer.org/
Login to D1 via SSH. I’m guessing you have setup both servers with password and not keys, if you are using keys, then let me know. Now let’s copy all files from D1 to D2, but since I don’t know your exact web-root paths, you will need to adjust those. I’m expecting that D1’s web-root is
/var/www/html
:It’s going to take a little time to copy the data depending on how many media files you’ve uploaded to D1’s WordPress.
We will copy the Nginx configuration as well:
Log out of D1. We’re done with that server.
The rest is done only on D2.
Now let’s upload the D1 database to D2. Again, install Adminer to D2 unless you already have phpMyAdmin. If the D1 database name is already in use on D2, then you might need to modify the database name before uploading it. I need more information from you to assist here.
And now let’s update the
/var/www/my-website.com/wp-config.php
file, so the database configuration matches the login on D2 - and in case you have renamed the database, then change that too. Let’s also make sure it’s owned bywww-data
, which I guess is your Nginx+PHP user:Adjust the Nginx configuration
/etc/nginx/sites-available/my-website.com
so it uses theroot
of/var/www/my-website.com
. And then activate the configuration:Test the configuration - if it returns “OK”, then restart Nginx too:
Now we should be ready to change the DNS to point the D1-domain to the IP of D2. There’s way to test this before changing the DNS, by modifying your computers
hosts
file. If you want to be totally sure, we can do that before changing the DNS.Hello there,
We do have an article that covers the process, although it is with deprecated status, however, you can check it here:
https://www.digitalocean.com/community/tutorials/how-to-migrate-wordpress-from-shared-hosting-to-a-cloud-server-with-zero-downtime
You can use the
WP All in One plugin
orDuplicator
to migrate all of your WordPress websites.https://wordpress.org/plugins/all-in-one-wp-migration/
https://wordpress.org/plugins/duplicator/
If you have to move some of the data manually you can do that via ssh using
scp
orrsync
. Another option is to use an FTP client like FileZillahttps://www.digitalocean.com/community/tutorials/how-to-copy-files-with-rsync-over-ssh
https://docs.digitalocean.com/products/droplets/how-to/transfer-files/
Hope that this helps!
This comment has been deleted