How to migrate the WordPress site to cloud server

How to migrate the Wordpress site to the cloud server

Hello Friends,

I have come with a new post. In this post, I will discuss how can you move your WordPress site from the shared hosting environment to cloud smoothly.

As we know WordPress is free and open-based content management system based on PHP and MySQL, which is mostly used for blogging. Many bloggers start their blog in WordPress with a shared hosting environment. This environment is good when we start our blog and have fewer visitors/traffic. But when the traffic goes high for your blog, then you should consider migrating your blog from a shared hosting environment to the cloud server.


Importance of moving your blog to Cloud server:

  • Simplicity:

Cloud server provides you with the simplicity. You can create your own server with your requirement in a few seconds.

  • Hardware:

Cloud servers are available in three platforms which includes Public, Private and Hybrid Cloud solutions. To know these things in details, click here.

In such solutions, you will have complete freedom to upgrade your resources at any point in time. Most importantly, hardware installation is not required in Cloud server so it takes no time to set up your cloud just pay as you go.

  • Uptime:

Afer the fall of the Amazon AWS last year, most of the people have some fear of the Cloud service. Check the whole story here. But the reality is that even with a drop in the characteristics of the Cloud server, it can work without falling. Let’s see how:

As you know that the cloud services are based on the allocation of the hardware resources in a virtualised network. It is not allocating the physical machines. So if a server within a Cloud Hosting falls, the connected network of servers is standing together to continue providing the service, while the engineers replace the part that fails. That is the reason, the cloud server has the highest uptime (keeping 100% effective).

  • Variety of Services:

Most vendors only facilitate a Cloud Hosting service, i.e. gives us the ability to create servers with the RAM, Processors and Disk space and freedom to decide your own configurations for the specified time and can be changed later. Every provider is different in manner of RAM, CPU and HDD but they all have one thing in common is “Build Your own server”. Cloud servers have major three services, 1) Platform as a service (PaaS) 2) Information as a Service (IaaS) 3) Software as a service (SaaS). You have to decide from this 3 services and deploy your cloud, according to your need on 3 platforms which are the Public Cloud, Private Cloud and Hybrid cloud.

  • Scalability:

One of the major disadvantages of using servers for hosting is that when sizing need to be clear, what is the starting point, which is the arrival, and how long it’s going to take on the road. This determines which hardware to buy and how much we have to scratch your pocket.

In the case of using Cloud, such issues go into the background. Obviously, we need to know if the service is able to bear the burden that we will commit, but if not, few mouse clicks are enough to increase their capacity and continue to provide service immediately. This expansion nearly cost without headaches. Hence we can say the cloud servers are instantly scalable.

  • Reliability:

Cloud servers are very much reliable in its service. It will provide you with better performance.

  • Profitability:

Cloud services are affordable and reliable. Not only because of the service it provides, but because it saves a lot of your costs and allows you to save lost in case you need to grow. Migrating your service to the cloud services will make you improve your profitability.

  • Pay for what you use:

One of the great advantages of Cloud Hosting is the ability to pay exactly what you use. In a hosting in the cloud have the great advantage of being able to start with a modest service tailored to your ability to pay and of course your ability to monetize at the time of the project’s output. There is no point spending a pasture if that makes you go to lose money.

  • A new standard of the Web Hosting:

In this era, most of the Internet users are addicted to Cloud Services and they are using the same. They are also happy with the services.

Reference: eUKHost

Now, I believe that the idea behind using the cloud services are quite clear to you. Migrating your blog/site to Cloud server also takes less time and it is simple as well. Just follow the steps correctly and you can migrate your blog/site to cloud in a few hours, without any downtime.

The steps are as follow:

  1. Create a Backup of the site and database.
  2. Make your cloud server ready and restore the site back up.
  3. Create the database and restore the backup of the database.
  4. Modify wp-config.php (optional)
  5. Test your site locally and switch the DNS once you are ready


Create a backup of the site and database:

Creating the backup of the site and database is very easy. There are different ways to take the backup of the site.

In cPanel server: You can take backup from cPanel or via command line.

To take the backup from cPanel, follow the below URLs:

cPanel web hosting control panel has some built-in scripts for you to backup or restore one or more cPanel accounts.

The script to make a full cPanel account backup via SSH is:

/scripts/pkgacct <cPanel username>

/scripts/pkgacct does create a full backup of an account, including databases, privileges, cPanel settings, email messages and accounts etc.

In Plesk server: You can take the backup of the site from Plesk panel. Follow the below URL to take a backup of your site:

If you want to take the backup of the site from the command line (via SSH), you need to go to the location “/var/www/vhosts/<YourDomainName>” and then compress the folder “httpdocs” using any compression command, like zip, tar, etc.

Note: If you want to take the backup of your site manually via SSH, then first you need to go to the document root of your site and then compress the folder of your site using zip, tar, etc. I would suggest you to compress it using tar. The complete syntax is given below:

tar -cvzf mysitebackup.tar.gz <folder of the document root>

Folder of the document root will be either, public_html, httpdocs, your site name, etc. It depends on where your site is hosted and what the is the document root for your site.

To take the back up your database, you can do this in 2 ways. First, you can do this from Database management tool, like phpMyAdmin. Secondly, you can run the mysqldump command from your command line (via SSH) to get the backup of your database.

Most important thing is, you need to identify the database name used in your site. To know the database name, open the file wp-confing.php (you will get this file at the location of your site’s contents) and search for “DB_NAME“. You will get your database name there. The format will look like:

define(‘DB_NAME’, ‘myblgdb’);

Here “myblgdb” is the name of the database used for WordPress site.

To take the backup of your database via phpMyAdmin, click here.

To take the backup of your database via command line (SSH), use the below syntax

mysqldump –u[user name] –p[password] [database name] > [dump file]


mysqldump –u root –pmypassword myblgdb > myblgdb.sql

Note: Make sure you add the extension .sql for your dump file.

If you feel difficulty in taking backup of your site/database, feel free to ask your doubt in the comment section below.


Make your cloud server ready and restore the site back up:

Once your cloud server is ready, restore the backup of the site. So first move your backup from your shared hosting environment/local PC to the cloud server. You can use scp command to move your backup to the cloud. The syntax is given below:

scp [backup file of your source server] [destination server]


scp mysitebackup.tar.gz username@cloud_server_ip_address:/home

Find the document root your site in the cloud server and restore the backup to the same location. You can use the below command to restore:

tar -xvzf mysitebackup.tar.gz

Change the ownership of the files and folders to the cloud server. Generally, it is under the ownership of www-data. However to verify and confirm the ownership, check your web server configuration file.


Create the database and restore the backup of the database:

To create the database on your cloud server, first, go to your MySQL prompt by typing mysql. If your MySQL is password protected, then use the below command:

mysql -u root -p

and then use your MySQL password to access MySQL prompt.

To create the database, use the below command:

create database database_name;

Note: Make sure you use the correct database name (given in the wp-config.php file), or else your site will throw “Database connection error”, even after setting everything correct.

Now create the database user. To create a database user, type the following command. Replace username with the user you want to create, and replace password with the user’s password:

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';

Note: You should use the same database username and password present in the wp-config.php. If you want to use different database username/password, then you should update the same in wp-config.php file.

Once you are done with creating a database and its user, close the MySQL session by typing exit;

To move your database backup, use the same scp command stated above. Now restore the database by using the below command:


mysql database_name < database_name.sql


mysql myblgdb < myblgdb.sql


Modify wp-config.php:

If you have created different database/database user/password, then update the same thing in the wp-config.php. Please note that this is an optional step. This step is required, when you use the different database details for your site on the cloud server.


Test your site locally and switch the DNS once you are ready:

Since everything is set up correctly, it’s time to test the working of the site. I would suggest you to first test the working of your site locally. To test the site locally, add the below content in the hosts file of your system.


Suppose the cloud server’s ip address is: and let us say your blog name is: then the hosts file will be modified as:

Now check the working of your site in your browser. Also, make sure you check the working of sub-links of your site. Once you are sure that everything is working fine, switch the DNS as per your convenience.

Note: I have assumed that your site was running on Apache web server and your new cloud server is also running on Apache web server. If you are running other web servers, like Nginx, you can reach us out for help and support.

If you feel difficulty in doing so, feel free to reach us out via the comment section. We would be more than happy to assist you.

Thank you!

Powered by Facebook Comments

Be the first to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.