DEV Community

Vikram Aruchamy
Vikram Aruchamy

Posted on • Originally published at askvikram.com on

How to Migrate WordPress From Shared Hosting to a Cloud Server With Zero Downtime

Introduction

Many bloggers start blogging with the shared hosting in the notion to pay less and get more support.

Shared hosting is a hosting where you share the hosting space with other webmasters. This may cause problems in your websites as well, when there are problems in other sites. For eg. if there is a Malware Attack in others site, then you are also vulnerable to the attack.

Moving to the Virtual private cloud servers will give a server which hosts your websites alone.

In this tutorial, you’ll learn about the steps to migrate your WordPress website from shared hosting like Godaddy to DigitalOcean or any other cloud provider.

If you find it difficult to migrate to cloud hosting Digitalocean, try DigitalOcean with Cloudways for Free.

Try DigitalOcean with CloudWays for Free

Prerequisites

Create an account with Digital Ocean and create one droplet to host your wordpress site.

Step 1 – Creating Backup of Existing WordPress Sites

In this step, you’ll create a backup of your existing wordpress site.

This backup file can be used to import into your new server and it might also help you restore your site when there is any problem during migration.

To create a backup of your wordpress site, you need to install a plugin called All in one WP Migration.

When you install and activate this plugin, you’ll be able to see the option All-in-One WP migration option in the WordPress Menu.

Click on that menu, and select Export option.

Now, you’ll see the of options where you can export the file. Select file option and export the file to your local location.

Your backup is created. Now let’s move to the next step.

Step 2 – Installing Wordops in New Server

In this step, you’ll install Wordops in your new VPS server.

Wordops is a tool which eases the WordPress site Installation and server administration.

When using this, it automatically takes care of installing the necessary software stack(WordPress, MySQL, PhP, NGINX) installation for running wordpress sites in the server.

You can install the WordOps using the command below.

 wget -qO wo wops.cc && sudo bash wo site.tld --wpfc  
Enter fullscreen mode Exit fullscreen mode

WordOps and the full stack required for installing WordPress is installed.

Now let’s create sites on WordPress.

Step 3 – Creating Sites

In this step, you’ll install the wordpress for each site that you want to configure in the new VPS server.

For each site, you need to follow the below step once.

Run the below command to create wordpress site your domain.

By default, we are creating wordpress site with Nginx fast cache.

If you would like to use any other type of cache in the wordpress installation, refer the link in the Wordops official page.

  wo site create site.tld --wpfc  
Enter fullscreen mode Exit fullscreen mode

site.tld should be replaced with your domain name. For e.g. askvikram.com where askvikram is site and tld is .com extension.

The fresh wordpress site is created with the basic settings.

Now let’s move on to next step to migrate the contents from the backup to this new server.

Step 4 – Importing the Backup to New Server

To migrate the content from the backup to the newly installed wordpress installation, login to the newly installed wordpress installation using the IP address of your server and wp-admin.php url.

You’ll see the default wordpress dashboard.

Go to Add new plugins page, Install the same All-In-WP-Migration plugin which can be used to import.

When you install and activate this plugin, you’ll be able to see the option All-in-One WP migration option in the WordPress Menu.

Click on that menu, and select Import option.

Now, you’ll see the of option to import the file.

Select file option and import the file. Click Finish.

This operation will completely import the content of your site from the shared hosting including your usernames and passwords.

You will also need to update the desired URL Type in the option that is shown.

WordPress import is complete and now your site is available in the new VPS server.

Now lets see how to encrypt it using the lets encrypt ssl certificates.

Step 5 – Updating the SSL for New Site

Use the below command to fetch the ssl certificate for your server from the site.

wo site create site.tld --wp --letsencrypt

  wo site create site.tld --wp --letsencrypt  
Enter fullscreen mode Exit fullscreen mode

This will update the lets encrypt certificate for your website.

Step 6 – Updating DNS Settings in DigitalOcean

Go to the digital ocean server and click Networks → domains.

Add a record for your root domain and update the IP address of the digitial ocean droplet.

Step 7 – Updating Nameservers in Domain Registrar

Finally, update the name servers in the domain registrar.

Update the name servers as ns1.digitalocean.com. So this is the server which will be looked upon by the browsers to check the content of the websites.

Conclusion

In this article, you have migrated to the VPS hosting from the shared hosting.

You’ve saved a lot of money and come out of the shared hosting where you were vulnerable to the issues of other webmasters.

Will There Be Any Downtime for the Site Migration to Digitalcoean?

No using this guide, there is not downtime.

Top comments (1)

Collapse
 
georgehenrique profile image
George Henrique

Para mim tem sido muito bom usar o Wordops.