I had the pleasure of migrating a wordpress site from a shared hosting into a VPS (Virtual Private Server) instance. The motivation behind it is to have greater resources and to be able to do more server level optimisations. Plus it allows me to use letsencrypt secure certificate.
The experience was pretty good, it took about half a day to migrate and only because my internet connection wasn’t all that fast. I reckon with better connection it would have been done in 2-3 hours or so.
Today I will share my steps in hope that it will help out those who needs to do the same with zero downtime.
- In your original site, install the plugin all-in-one wp migration.
- Start the export process through the plugin. You can download the archive file to your local computer.
- While its exporting, sign in or join up with the a vps provider. The ones that I like are DigitalOcean, Vultr and VPSdime. They are very affordable and reliable.
- Once logged in, simply spin up a vps instance. I’d recommend to start with the lowest that your website needs as you can scale up later most of the time.
- Install the usual LAMP stack. You can use the apt-get install with Apache, PHP and mysql.
- After the setup is complete, take a note of the new server ip address.
- Open your computer host file and add your domain name to the list. This way your computer will be able to use the domain name to access the new server.
- Now install a fresh wordpress installation in your new vps instance. Don’t worry about themes or any other plugins for now as this will get transferred with the import.
- Install the all-in-one wp migration plugin in the new wordpress installation.
- By this time hopefully the original wordpress export download should be completed.
- In your new site, go to all-in-one wp migration and click on import. Simply choose the newly downloaded wordpress archive.
- If you happen to have issue with file upload size, just ssh into your vps and update the php.ini to adjust the max upload size and max post size.
- Wait till the upload is complete, this is where it takes ages for me by the way.
- Once you are prompted to start the import, just proceed as instructed.
- In my case almost everything went well but the database import was stuck. I simply waited for another 30 mins and then kill the browser. The problem was the plugin was unable to do its progress poll because the secure .htaccess file from the imported archive was blocking it.
- Login into your newly imported website and make sure everything is there. Check your old posts, image links, etc.
- Once satisfied, undo your host file changes in your machine. Your browser once restarted should point to your old site again.
- It’s now time to point your domain name to the new vps instance.
- Login to your DNS provider, change the a record to point to your vps instance’s IP.
- Open private mode browser just in case then load your website. You should now be pointed to your new server.
That’s it! Phew in 20 steps. I recommend keeping the old server live for a couple days just on case anything bad happen to the new server, all you need to do is point he DNS back to your old IP.
Hopefully, this post help out some of you who are wondering to migrate to a vps instance.devops, migration, vps