Need help moving/migrating a WordPress site to DigitalOcean Cloud VPS from your old, slow shared hosting company? We have tested different methods and came up with a tested step-by-step guide on how to migrate a WordPress site to DigitalOcean:
Table of Contents - Article Hierarchy
- Step 1: Create a Droplet
- Step 2: Initial Droplet Setup
- Step 3: Log into SSH and Basic SSL Installation
- Step 3: Droplet is Ready, finish fresh WordPress Installation
- Step 4: Export the site that you want to move!
- Step 5: Import the site to DigitalOcean.
- Step 6: Complete Import
- [Fix] SSL is not working: Can’t access the site via https even after installing the certificate?
Step 1: Create a Droplet
Log into your DigitalOcean account and deploy away a droplet by following this:
Create ^ >> Droplets >> Marketplace >> WordPress on Ubuntu 18.04
Plan: Choose the basic $5/month plan for new sites (1 GB / 1 CPU / 25 GB SSD / 1000 GB transfer). If your site receives 5k+ daily visitors, I’d suggest you to go for a plan with at least 2 GB of RAM.
Datacentre Region: Choose according to the target audience of the site.
Change Hostname to the actual domain of the site.
Click on “Create”.
Step 2: Initial Droplet Setup
Once Deployed, go to the Droplets page, and click on “More” option.
Click on “Add Domain” and point it to the droplet IP.
Also, add a CNAME for “www” and add value “@” for the second option.
Step 3: Log into SSH and Basic SSL Installation
Once the domain is added, check the email from DigitalOcean for the SSH password.
Install Putty, and login in as this:
Password will be sent to you by DO via mail.
It will prompt you to change the password. I hate typing that default password multiple times just for confirmation. :/
Install SSL as prompted in the wizard. And select 1, 2 (for both www and non-www versions of the site) in the particular step.
Step 3: Droplet is Ready, finish fresh WordPress Installation
Go to the droplet IP and complete the WordPress installation process (temporary logins)
We will now move the site using a plugin called “All-in-One WP Migration”. Install it in the fresh WordPress installation.
Step 4: Export the site that you want to move!
Go back to the live site in the shared hosting.
Log into the WordPress dashboard, and install this plugin: “All-in-One WP Migration”
From side menu of the plugin, click on “Export”.
Export the site as file and download it onto your PC. Sorry, no wget 🙁
Step 5: Import the site to DigitalOcean.
Go back to the Fresh WP installation, and click on “Import”
Select the file and upload it.
Special Case: Possible Error
“Your file exceeds the maximum upload size for this site: 16 MB”
Fix it by following these instructions:
Update the .htaccess file with the code given here.
To update the file, you can either use a FTP client like FileZilla, or use SSH (my favorite).
For SSH, download Putty on Windows or use the terminal on macOS. Log into SSH and do the following:
cd / cd var/www/html sudonano .htaccess
Add the .htaccess code found above. Use appropriate values according to your needs.
I will use this for my example:
php_value upload_max_filesize 1500M php_value post_max_size 1500M php_value memory_limit 1500M php_value max_execution_time 20000 php_value max_input_time 20000
Save: Ctrl + O
Exit Nano Text Editor: Ctrl + X
Restart Apache 2 with this command:
sudo service apache2 restart
Step 6: Complete Import
From side menu of WP dashboard under plugin options, click on “Import” and upload the file.
Once finished, you might be prompted an option like this:
Just click on “Update WordPress Database”.
Log into the site using the old WP login credentials and perform the following steps:
(1) Update Permalinks to avoid 404 errors from here:
(2) Update WordPress Address (URL) and Site Address (URL) from here:
*If https is not working yet, go to this section to fix it.
Confirm that the site is migrated properly by using the droplet IP.
Now, all you have left to do is to update the domain nameservers to that of DigitalOcean.
Log into your Domain Registrar and update the NS information to the following:
DNS propagation may take some time. You can fasten this process by using a VPN. Connect to an IP nearest to the server region and confirm that the site is actually loading on the Digital Ocean IP. To do this, you can use CMD Ping on Windows 10 and terminal ping on macOS.
Finally, just confirm that the site is loading properly on the new server droplet. And don’t forget to check the SSL status so that everything is in place. You can use a SSL verification tool like Wormly or SSLLabs.
[Fix] SSL is not working: Can’t access the site via https even after installing the certificate?
If the SSL is not working, install Let’s Encrypt Free SSL again by performing the following SSH commands in order:
sudo apt-get update sudo add-apt-repository ppa:certbot/certbot sudo add-apt-repository ppa:certbot/certbot sudo apt-get install python-certbot-apache sudo apachectl stop letsencrypt --authenticator standalone --installer apache -d domain.com sudo service apache2 restart
If you are still getting “Connection is not fully secure” errors on pages, you can install this WordPress plugin called Really Simple SSL.
Set Up Let’s Encrypt Auto Renewal
Bash the following code into SSH (replace domain.com with your hostname):
0 1 1 */2 * cd /usr/local/letsencrypt && ./letsencrypt-auto certonly --apache --renew-by-default --apache -d example.com >> /var/log/example.com-renew.log 2>&1
Voilà. Done and Dusted.
I think I’ve covered everything. If you think I’ve missed out on any special case, or you have found a more efficient way to get this done, or if you are having any problem following a part of the procedure, do let me know in the comments section below and I’ll try my best to come up with a solution. If you’ve found this helpful in some way, and want more posts like this on the blog, please share it across your social profiles and of course to the needy. Adiós!