A reliable website is one of the key factors that give assurance to your customers.
Migrating to the cloud strategy help to handle the heavy traffic to your websites. Moreover, cloud hosting comes with options to scale up too.
However, migrating existing shared cPanel account to a cloud hosting need proper planning to avoid data loss.
As part of our Migration Services, we frequently help our customers to migrate their accounts to the cloud platform.
Today, we’ll see the best practices that our Migration Engineers follow in cPanel to cloud migration.
Benefits of cloud hosting
Firstly, let’s take a quick look at why many users nowadays choose cloud hosting for their websites.
Hosting in cloud solutions like DigitalOcean, AWS, Linode, etc. gives a ready option to scale up. That is, you can start with minimum resources for your website. Later on, as and when the site traffic goes high, we can add additional resources.
Again, cloud websites will have overall protection against common security attacks. The entire cloud network will be secured by the cloud firewall.
Similarly, cloud solutions are known for their reliability. Thus, it typically avoids website down due to server crashes.
Last and not least, most cloud solutions provide a panel for managing the servers. It helps to track the server resource usage, bandwidth data, etc.
That’s a good set of reasons why user migrates their shared cPanel account to Cloud solution. But, the actual cPanel to cloud migration involves a series of processes.
Steps to migrate cPanel account to cloud hosting
cPanel to cloud migration is a multi-step process. It involves working from the command prompt. Let’s see how our Migration Engineers move the cPanel account.
1. Set up a new cloud instance
The very first step is to finalize and create a cloud instance. The choice of the cloud solution provider depends on the requirements of the website. For example, a simple website can be accommodated at a beginner level server. Or, if the server is having a heavy application, it has to be on a powerful server.
After creating the cloud instance, our Migration Engineers confirm that the new server has compatible PHP, Apache, Web server versions.
Also, we alter the DNS settings of the domain in a way that DNS changes propagate faster. This change will be done at the nameservers of the domain.
2. Create database backup
Most website applications like WordPress, Magento, etc. use a database to store the data.
So, the next step is to create the backup of the database. To create the backup file using cPanel account login, we use the following command:
mysqldump -u yourdbusername -p yourdbname > database.sql
We put the database backup file in the public_html directory itself.
Again, when migrating multiple databases or accounts, we use the cPanel server root login and create shell scripts to collect the backup of databases.
3. Get the website files from cPanel
Now its time to get the backup of the website contents. We use the File Manager of the cPanel hosting to generate the backup. We first navigate to the root directory of the website. Then, compress all the files and folders in a zip file.
Now the website and database backup will be available at www.yourdomain.com/websitebackup.zip
4. Restore in the cloud server
Further, we need to restore the contents in the cloud server. Our Migration Engineers use the command line to restore the contents.
Most cloud solutions come with options to install WordPress or Magento websites with a single click.
Before performing cPanel to cloud migration of your website, we always remove the existing database and files if any. Then, we unzip this file in the document root of the website by running this command:
That would bring in all the website files. After that, we correct the permissions and ownership of the files. This should match the user under which the website runs.
Now we import the database on to the cloud server by running this command:
mysql -u databaseuser -p database < database.sql
5. Preview the website
The next up in the migration is previewing the website from the new server. This helps us to evaluate how the website loads on the new server. It also helps to spot any error with specific functions, plugins, etc.
The preview link will be something like http://cloud_server_IP/website
Similarly, we can add /etc/hosts entry for the domain to the new server IP address. This also would load the website from the cloud server.
6. Final Rsync
When the DNS switch does not happen immediately after data transfer, the content on the new server may not be identical to the old cPanel account. This applies to the database as well. Therefore, our Migration Specialists always do final sync before the final DNS switch.
7. DNS changes
Finally, after correcting all the errors, we change the DNS of the cPanel domain to the new IP address. Since we already set the TTL value as 15 minutes, the new IP address will propagate on the internet fastly.
That completes the cPanel to cloud migration and the website now loads from the new cloud server.
Best practices in migrating to the cloud
Let’s do a recap on the best practices that our Migration Engineers follow during cPanel to cloud migration.
- Making the cloud server identical to the cPanel server. This includes setting the similar program versions including that of PHP, Web server, MySQL, etc.
- Reducing TTL values much before the actual migration. This would avoid the website downtime due to DNS propagation.
- Removing existing content on the instance and starting afresh.
- Preview the website from the new server before actual DNS changes.
- Final rsync of the website content and database to include the maximum changes.
[Worried about data loss during the migration of cPanel account to the cloud server? We can help you right away!]
In short, cPanel to cloud migration has multiple benefits like scalability, reliability, etc. It enables the website to handle heavy traffic without any downtime. Today, we saw the best practices that our Migration Engineers follow while migrating cPanel account to cloud hosting.