Migrating WordPress Site from Shared Hosting into VPS Hosting

July 24, 2017 7:04 pm Leave your thoughts

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.

  1. In your original site, install the plugin all-in-one wp migration.
  2. Start the export process through the plugin. You can download the archive file to your local computer.
  3. 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.
  4. 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.
  5. Install the usual LAMP stack. You can use the apt-get install with Apache, PHP and mysql.
  6. After the setup is complete, take a note of the new server ip address.
  7. 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.
  8. 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.
  9. Install the all-in-one wp migration plugin in the new wordpress installation.
  10. By this time hopefully the original wordpress export download should be completed.
  11. In your new site, go to all-in-one wp migration and click on import. Simply choose the newly downloaded wordpress archive.
  12. 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.
  13. Wait till the upload is complete, this is where it takes ages for me by the way.
  14. Once you are prompted to start the import, just proceed as instructed.
  15. 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.
  16. Login into your newly imported website and make sure everything is there. Check your old posts, image links, etc.
  17. Once satisfied, undo your host file changes in your machine. Your browser once restarted should point to your old site again.
  18. It’s now time to point your domain name to the new vps instance.
  19. Login to your DNS provider, change the a record to point to your vps instance’s IP.
  20. 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.

Tags: , ,

Categorised in: , , ,