How To Migrate WordPress to Digital Ocean
Techieshelp has moved to Digital Ocean, after one too many problems with the previous provider the jump was made over the weekend. This article is not so much a technical guide but more the steps that are required to move your WordPress based website from one VPS provider to another.
Techieshelp has grew quite a bit over the last 12 months and now has over 100k unique visitors per month and this shows no sign of slowing, I needed a VPS provider that is reliable and will help me scale upwards as the site grows. I chose Digital Ocean after reading various reviews and looking into the features they offered. By the way if you use this link – Digital Ocean you will get $10 off your first months VPS bill.
What Linux Distro is Best For WordPress?
As mentioned, Techieshelp is based on WordPress so I needed to choose a build for my new VPS that would make WordPress blisteringly quick. Digital Ocean offered me the option of Ubuntu 14.04 with the LEMP stack built already into it, this was a great start. For those who do not know what the LEMP stack is then the acronym stands for Linux, Nginx (pronounced Engine x), MySQL, and PHP.
Ubuntu was my Linux of choice, Nginx is a lightweight web server that is quick and scalable, MySQL maria is an industry standard database server and I went for PHP5-FPM.
When signed into Digital Ocean and you have chosen your VPS package you can then choose the software build as seen below, once done it was built in seconds. What I would advise is during the MySQL install is call the DB the same name as your current DB to make the migrate easier, also keep usernames the same.
I now had my nice shiny new VPS with the basics installed ready to install WordPress onto the LEMP stack. My previous VPS was Centos which I installed WordPress on myself, this time I used the following guide to get WordPress up and running with a blank config ready to migrate Techieshelp into.
I now had nice blank canvas to start from. Before pulling Techieshelp to this new VPS I thought I would fine tune it to give it that extra bit of performance.
MemCached and APC
With the above extensions I can load the database for Techieshelp into memory and cache all images and objects that may be called. Memcached will handle the DB side of things and APC will be used for Caching, tie this in with W3 Total cache and you are onto a winner. To install Memcached then use the following link.
For APC then the following link.
You now have a supercharged WordPress VPS, we just need to migrate over the existing files and DB.
Migrating WordPress to New VPS
I recommend a backup plugin for WordPress called BackWPup this will backup all your files and DBs, it will even optimise them if you like, I use this in conjunction with Dropbox so everything is backed up offsite. Install that plugin, create a job and you will have a zip file of your WordPress files and SQL.
To copy the files to you new VPS make sure SSH is enabled on the VPS (port 22 – it should be as you have been configuring the above!). Then download WinSCP . Once done run WinSCP by logging into your VPS with the Root account and point it to the VPS IP. You will then see a screen where you can drag and drop files onto your VPS.
Simply extract the Backup zip file you created with BackWPUp then copy all the files to the folder WordPress was installed into. We now just need to concentrate on getting the WordPress DB installed.
You can either be really clever and do it via command line with this link below or use a control panel to do it as seen below.
Installing Webmin onto Ubuntu VPS
Again its link time, follow the guide below.
Migrating WordPress Database With Webmin
Now log into Webmin and we will use the MySQL server to import the WordPress DB we backed up with BackWPup, it will be in the zip file you downloaded.
In Webmin browse to the following: MySQL Server > Your DB Name > Execute SQL
You will get a browse menu, simply browse to the SQL DB file you have extracted from your ZIP file. It will take a few minutes to upload your DB and then you should be ready to go and you are fully migrated. If not…
Some Gotchyas Help!
You may find that you get a cannot connect to DB error. This is normally because the DB name, Username or Password is incorrect in WP-Config.php. Simply edit that file and change to the correct details, to confirm these details you can get them from Webmin MySQL and users.
You may find that your WordPress site shows a blank white screen. This is down to the Nginx or Apache server not being able to read the wordpress folders. Run the command below, if you used the digital ocean guide above the user will be web-data.
chown -hR web-data /var/www/yourwebsite.com
That should be it, all that is left is you contact your Domain provider and point your A records to your new VPS.
Tags: cloud, DigitalOcean, vps, Wordpressmigrate
Great post, very helpful.
I’m curious why not choosing directly WordPress on 14.04 in the applications list, instead of the LEMP on 14.04 option?
Is there any advantage?
Hi Jeudy, I chose the lemp stack as this runs Nginx, the WordPress build you mention runs Apache.
Nginx is a lot more light weight and on heavy traffic sites performs better. Granted it takes a little more configuration but there are plenty of guides out there.