How to Seamlessly Transfer a WordPress Website from HestiaCP to CloudPanel

Learn how to transfer a WordPress website from HestiaCP to CloudPanel seamlessly. This step-by-step guide covers file transfer, database migration, DNS updates, and SSL setup for a smooth WordPress migration process.

123 Views
8 Min Read
Disclosure: This website may contain affiliate links, which means I may earn a commission if you click on the link and make a purchase. I only recommend products or services that I personally use and believe will add value to my readers. Your support is appreciated!
- Sponsored Ads-

Migrating a WordPress website from one hosting environment to another may seem like a daunting task, but with the right steps, it can be straightforward and hassle-free. In this detailed guide, I will walk you through the entire process to transfer a WordPress website from HestiaCP to CloudPanel using SSH, rsync, and basic WordPress configurations. We will also cover how to manage the database transfer and update the DNS for a smooth migration. By the end of this guide, you’ll have successfully moved your WordPress website without downtime or data loss.

Step 1: Log in to the HestiaCP Server

The first step in migrating your WordPress site is to log in to your HestiaCP server using SSH. You need to be logged in as the root user to have full control over the files and database.

Open your terminal and enter the following command to log in to your HestiaCP server. Replace <hestiacp-ip> with your server’s IP address, and <hestiacp-ssh-port> with the correct SSH port (in this case, it’s 4891):

ssh root@<hestiacp-ip> -p <hestiacp-ssh-port>

For example, if your HestiaCP server’s IP is 94.72.110.101 and the SSH port is 4891, if your ssh port is 22 or default then you do not need to add the port syntex the command would be:

- Sponsored Ads-

ssh [email protected] -p 4891

Without port or default port

ssh [email protected]

Once logged in, navigate to the WordPress installation directory where your site files are stored. Typically, for HestiaCP users, this is located in /home/$username/web/domain.com/public_html/.

cd /home/$username/web/domain.com/public_html/

This command moves you into the WordPress root directory where all the essential files, such as wp-config.php, themes, plugins, and uploads are stored.

- Sponsored Ads-

Step 2: Create a Database Backup

Before you can move your website, you need to back up the WordPress database. The database contains all your posts, pages, comments, and configuration data, making it essential for a complete migration.

To create a database dump, use the mysqldump command. You will need the database username, password, and database name, which can be found in the wp-config.php file. The syntax for the command is:

mysqldump -u <db-username> -p <db-name> > <db-backup.sql>

For example, if your database name is dnbbharat_mnodb and the username is also dnbbharat_mnousr, the command would look like this:

mysqldump -u dnbbharat_mnodb -p dnbbharat_mnousr > dnbbharat_mnodb.sql

You will be prompted to enter the MySQL password. Once entered, this command will create a SQL dump file (dnbbharat_mnopldb.sql) containing your entire database in the current directory which is /home/$username/web/domain.com/public_html/

Step 3: Set Up a New WordPress Site on CloudPanel

Now that you’ve backed up the files and database, you can set up your new environment on CloudPanel. Log into your CloudPanel dashboard and create a new WordPress site using the domain that you want to transfer. CloudPanel makes it easy to set up WordPress by providing tools to manage domains, databases, and SSL certificates.

When setting up the new website, make sure to create a new database with the same name as the one used in HestiaCP, as this will make importing the database much simpler later.

Step 4: Transfer Files and Database Using rsync

Now that the CloudPanel environment is ready, it’s time to transfer the WordPress files from HestiaCP to CloudPanel. For this, we will use the rsync command, which is a fast and secure tool for syncing files between two servers over SSH.

Here’s the command to transfer your WordPress files from HestiaCP to CloudPanel. Replace the placeholder values with your actual usernames, IP addresses, and paths.

rsync -avz -e "ssh -p <cloudpanel-ssh-port>" /home/$username/web/domain.com/public_html/ root@<cloudpanel-ip>:/home/$username/htdocs/domain.com/

For example, if your HestiaCP and CloudPanel servers have the following details:

  • HestiaCP user: domainusr

  • CloudPanel user: domainusr

  • Domain: domain.com

  • CloudPanel IP: 184.219.111.230

  • SSH port: 4891

The command will be:

rsync -avz -e "ssh -p 4891" /home/$username/web/domain.com/public_html/ [email protected]:/home/domainusr/htdocs/domain.com/

If you are using default port or port 22, your command will be like this:

rsync -avz -e /home/$username/web/domain.com/public_html/ [email protected]:/home/domainusr/htdocs/domain.com/

This command will transfer all the files from the WordPress directory on HestiaCP to the corresponding directory on CloudPanel. The -a flag ensures that all file permissions and timestamps are preserved, while -z compresses the files during transfer to make it faster.

Step 5: Update Your Domains DNS Records

After transferring the files, you need to update your DNS records to point your domain to the new CloudPanel server’s IP address. Log into your DNS management provider (like Cloudflare or GoDaddy) and update the A record of your domain to point to the CloudPanel IP (184.219.111.230).

Step 6: Install SSL Certificate in CloudPanel

To ensure that your website is secure, it’s important to install an SSL certificate on the new CloudPanel server. In the CloudPanel dashboard, go to the website settings and enable the SSL option to automatically generate and install a Let’s Encrypt SSL certificate for your domain. May be you have to wait for few minutes to issue a ssl certificate after changing your ip.

Step 7: Import the Database on CloudPanel

With the files transferred and the SSL certificate installed, the last step is to import the WordPress database into the CloudPanel server. You will use SSH to log into the CloudPanel server and run the import command.

First, log into the CloudPanel server as the website user:

ssh [email protected] -p 4891

Without custom port or with default port your command will be:

ssh [email protected]

Once logged in, change your active directory to domain root before running next commands, use the clpctl command to import the database SQL file that was transferred earlier using rsync:

cd htdocs
cd domain.com
clpctl db:import --databaseName=<database-name> --file=<db-backup.sql>

For example:

clpctl db:import --databaseName=dnbbharat_mnodb --file=dnbbharat_mnodb.sql

This command will restore your database to the CloudPanel environment, completing the migration process.

Update: You might need to fix file permission

You might need to fix file permission in your cloudpanel user account as because we are using root user to transfer the files using rsync command, to do so change your directory to your domain root using below commands then run next command one by one.

cd htdocs
cd domain.com
clpctl system:permissions:reset --directories=770 --files=660 --path=/home/domainusr/htdocs/domain.com

Conclusion

Migrating a WordPress website from HestiaCP to CloudPanel is a multi-step process that involves transferring both the files and the database, updating DNS settings, and ensuring everything is configured correctly on the new server. Using rsync for file transfer and mysqldump for database export and import ensures that the migration is seamless and efficient. By following the steps outlined in this guide, you can safely transfer your website without any significant downtime.

Remember to test your website thoroughly after migration to ensure that all functionality works as expected and that your website visitors experience no issues.

- Sponsored Ads-

About us

Teklog blog

Share This Article
Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *