How to Migrate Your WordPress from cPanel or Plesk to Vultr

Introduction

WordPress migration is an important task that allows you to shift from one provider to another. Usually, when you experience site performance issues linked to underlying infrastructure performance, migrating your site to a new host can improve your general site reliability and ranking.

In a shared hosting environment, cPanel and Plesk are two of the most popular control panels that offer a graphical web interface that allows you to manage your server features and functions. Among the key advantages to consider when migrating from cPanel or Plesk to Vultr include the following:

  • Improved site reliability and uptime
  • Clear bandwidth usage statistics
  • Improved Security with optional Vultr Firewall functionalities
  • Full access to your backend server

This article explains how to migrate your WordPress site from cPanel or Plesk to Vultr using a Ubuntu production server. You are to apply the FTP or SFTP to handle file transfer, and mysqldump to restore your WordPress database on the server.

Prerequisites

Before you begin, make sure you:

  • Deploy a OneClick WordPress server on Vultr using the Vultr Marketplace applicationOr, you can deploy a cPanel or Plesk server using a OneClick application from the Vultr Marketplace to keep your graphical management environment when switching providers.
  • Have access to the WordPress site domain DNS records
  • Use SSH to access the WordPress server
  • Create a standard user with sudo privileges. For example webadmin
  • Switch to the new user account # su webadmin

Set Up Your Vultr Server

WordPress requires a set of PHP extensions to run correctly on your server. By default, the Vultr OneClick WordPress image run all necessary extensions, a database server, and Nginx as the web server. In this section, create the WordPress MySQL database, and test your web server configuration as described in the following steps.

  1. Verify the installed PHP version $ php -vOutput: PHP 8.1.21 (cli) (built: Jul 12 2023 23:03:54) (NTS) Copyright (c) The PHP GroupMake sure the PHP version is 7.4 and above as required by WordPress
  2. To prepare the WordPress database. Log in to the MySQL database server as the root user $ sudo mysqlIf the above command fails to run, log in with the root user password $ sudo mysql -u root -pTo view the default Vultr server database password, run the following command $ sudo cat /root/.db_password
  3. Create a new database mysql> CREATE DATABASE wordpressdb;
  4. Create a new database user with a strong password. mysql> CREATE USER 'adminuser'@'localhost' IDENTIFIED BY 'YOUR STRONG PASSWORD';
  5. Grant the user administrative privileges to the database mysql> GRANT ALL PRIVILEGES ON wordpressdb.* TO adminuser@localhost
  6. Refresh MySQL privileges mysql> FLUSH PRIVILEGES
  7. Exit the MySQL console mysql> EXIT
  8. To set up the web server, create a new web root directory to store WordPress files $ sudo mkdir -p /var/www/example.com
  9. Switch to the main Nginx configuration files directory /etc/nginx $ cd /etc/nginx/> The Vultr OneClick application uses the LEMP (Linux, Nginx, MySQL, PHP) stack. When using LAMP, switch to the Apache directory instead
  10. Deactivate the default WordPress configuration files $ sudo rm /etc/nginx/sites-enabled/*
  11. Create a new WordPress configuration file in the sites-available directory $ sudo touch /etc/nginx/sites-available/example.com
  12. Using a text editor such as nano, edit the file $ sudo nano /etc/nginx/sites-available/example.com
  13. Add the following configurations to the file. Replace example.com with your actual WordPress domain name server { listen 80; server_name example.com www.example.com; # WordPress web root directory root /var/www/example.com; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; } # PHP Configuration location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Update the PHP-FPM socket path fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } # Set Expiry Headers location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } # Disable XML-RPC location = /xmlrpc.php { deny all; } # Enable Gzip compression gzip on; gzip_comp_level 4; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; }Save and close the file
  14. Activate the configuration file $ sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
  15. Test the Nginx configuration for errors $ sudo nginx -tWhen the web server configuration is valid, your output should look like the one below: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successfulIn case the test returns any errors. Fix the indicated error to avoid breaking your web server configuration
  16. Restart Nginx to apply your WordPress host configuration changes $ sudo systemctl restart nginx

Migrate WordPress from cPanel to Vultr

To migrate your WordPress site from cPanel to Vultr. Verify that your cPanel account supports FTP accounts, then back up your WordPress files and database to restore them on the target Vultr WordPress server as described in the steps below.

1. Backup WordPress Files

  1. In the Files section, click to open File Manager
  2. Find and view your WordPress web root directory. Usually /public_html or your-domain.com depending on your account setupcPanel file manager
  3. On the top bar, click Select All to start the WordPress backup process.
  4. Click Compress to create a backup archive file.
  5. In the Compress dialog, select your desired Compression Type. For the best results, select GZiped Tar Archive
  6. Verify that all WordPress files are available on the Files to compress list
  7. Enter a custom name to assign the backup file. For example, backup.tar.gzcPanel file compression resultsWait for the backup process to complete, and close the Compression Results dialog
  8. Verify that a new archive file is available in your target directory

2. Backup the WordPress Database

  1. Navigate to the main cPanel dashboard
  2. Find the Databases section, and click phpMyAdminThe cPanel phpMyAdmin databases option
  3. Within the phpMyAdmin interface, find and click your target WordPress database on the left navigation menuIn cases where you have multiple WordPress websites, view your target site’s wp-config.php file and note the database name
  4. Click Export on the main navigation bar
  5. In the Export Method:, keep Quick-display only the minimal options selectedExport WordPress database
  6. Keep SQL as the Format:, and click Export to download the WordPress database backup to your computer
  7. When the download is complete, visit your downloads directory and verify that a new .sql file is available on your computer
  8. To access the database in your cPanel files, navigate to the File Manager
  9. Switch to the WordPress files directory and upload the database.sql file to the path
  10. When the database upload is complete, prepare your account for transfer to the new WordPress server

3. Prepare the cPanel File Transfer Accounts

  1. Navigate to your main cPanel account dashboard
  2. Find the Files section, and click FTP AccountsFTP Accounts cPanel section
  3. Within the Add FTP Account form, enter your desired username in the Log In field. For example wpbackup
  4. Enter a strong password in the appropriate fields
  5. In the Directory field, replace the placeholder values with your WordPress web root directory public_html/
  6. Keep the Quota set to unlimitedCreate a cPanel FTP Account
  7. Click Create FTP Account to add the FTP Account to your server
  8. Verify that the account gets created, and it’s listed in the FTP Accounts section

4. Transfer WordPress Backup Files from cPanel to your Vultr Server

  1. Using SSH, access your Vultr WordPress server $ ssh webadmin@SERVER-IP
  2. Establish an FTP connection to your cPanel server. Replace example.com with your actual domain name $ ftp wpbackup@example.com
  3. List files in the directory. > lsVerify that the backup.tar.gz and your database.sql files are available. If the user is only permitted to access /public_html, only WordPress files should display in the directory.
  4. Download the WordPress files archive file to your server > get backup.tar.gzOutput: local: backup.tar.gz remote: backup.tar.gz 200 EPRT command successful 150 Opening BINARY mode data connection for backup.tar.gz (3236 bytes) 100% |*********************************************************************************************************************************************| 3236 6.50 MiB/s 00:00 ETA 226 Transfer complete 3236 bytes received in 00:00 (16.41 KiB/s)
  5. Download the database backup file > get database.sqlMonitor the FTP get progress, and close the FTP connection when complete > exit
  6. List files and verify that all backup files are available in your working directory $ ls
  7. Extract files from the WordPress tar.gz archive to your web root directory $ sudo tar -xzvf backup.tar.gz -C /var/www/example.com/
  8. When the extraction is complete, grant the web server ownership privileges to the directory $ sudo chown -R www-data:www-data /var/www/example.com
  9. Restore the WordPress database to the MySQL database you created earlier $ mysql -u adminuser -p wordpressdb < database.sql
  10. When the restoration completes without errors, Log in to the MySQL database server $ mysql -u adminuser -p
  11. Switch to the WordPress database mysql> USE wordpressdb;
  12. Show the database tables to verify that all WordPress tables are available mysql> SHOW TABLES:Output: +----------------------------+ | Tables_in_wordpressdb | +----------------------------+ | wp_actionscheduler_actions | | wp_actionscheduler_claims | | wp_actionscheduler_groups | | wp_actionscheduler_logs | | wp_as3cf_items | | wp_commentmeta | | wp_comments |
  13. Exit the MySQL consolemysql> EXIT

You have migrated your WordPress site from cPanel to your Vultr WordPress server. Complete the migration process by setting up the correct DNS records and verify that you can access the WordPress site when DNS propagation is complete.

Migrate WordPress from Plesk to Vultr

To migrate your WordPress site from Plesk to your Vultr WordPress server. Log in to your Plesk account to access the control panel interface and carry out backup actions as described in the steps below.

1. Backup the WordPress Files

  1. On the left navigation menu, click Files to open the File Manager
  2. Within the File Manager interface, find and click httpdocs or your WordPress files directory such as example.comPlesk File Manager
  3. Check the Select All box next to Name to choose all WordPress files in the directory
  4. On the top menu bar, click the Archive dropdown and select Add to Archive from the list of optionsCreate a new Plesk Archive File
  5. Enter your desired WordPress backup filename. For example wpbackup
  6. Click OK and wait for the archiving process to complete
  7. When complete, verify that a new wpbackup.zip file is available in your httpdocs directory

2. Backup the Full WordPress Database

  1. Navigate to Databases on the main navigation bar
  2. Find your target database, and click Export DumpBackup a WordPress Database using Plesk
  3. In the Export Dump dialog, select the httpdocs directory, and enter your desired WordPress database backup filename. For example wpdb.zipCreate Plesk WordPress Database backup
  4. Click OK to back up your WordPress database
  5. When complete, navigate to Files and verify that a new .sql.zip file is available in your target directory httpdocs

3. Prepare the Plesk File Transfer accounts

  1. Navigate to Websites & Domains
  2. Scroll and find your WordPress domain name
  3. Within the domain section, click FTP to open the FTP Accounts page
  4. Click Add an FTP Account, and enter your desired username in the FTP account name field. For example wpbackupCreate a Plesk FTP account
  5. Click the Home directory and set it to /
  6. Enter a strong password and confirm the password for your FTP account
  7. Click OK to save changes
  8. Verify that the new FTP account is available on the accounts page and ready to handle connections to your Vultr Server

4. Transfer WordPress files from Plesk to the Vultr WordPress server

  1. Using SSH, access your Vultr WordPress server $ ssh webadmin@SERVER-IP
  2. Establish an FTP connection to your Plesk server $ ftp wpbackup@example.com
  3. Switch to the httpdocs directory > cd httpdocs
  4. Download the WordPress files archive file you generated earlier > get wpbackup.zip
  5. Download the WordPress database backup file > get wpdb.zip
  6. Verify that the FTP download process completes without errors and exit the FTP console > exit
  7. List files in your working directory $ lsVerify that the WordPress files and database backup are available
  8. Extract WordPress files from the backup archive to your web root directory $ sudo unzip wpbackup.zip -d /var/www/example.com/
  9. When complete, grant the web server ownership permissions to the WordPress web root directory $ sudo chown -R www-data:www-data /var/www/example.com
  10. Extract the WordPress database from the backup archive $ unzip wpdb.zip
  11. Restore your WordPress database to the new database on your server $ mysql -u adminuser -p wordpressdb < database.sql
  12. When the restoration is complete, log in to the MySQL database server $ mysql -u adminuser -p
  13. Switch to the WordPress database mysql> USE wordpressdb;
  14. View all database tables to verify that the correct WordPress structure is available mysql> SHOW TABLES;Output: +----------------------------+ | Tables_in_wordpressdb | +----------------------------+ | wp_actionscheduler_actions | | wp_actionscheduler_claims | | wp_actionscheduler_groups | | wp_actionscheduler_logs | | wp_as3cf_items | | wp_commentmeta | | wp_comments |
  15. Exit the MySQL database console mysql> EXIT

You have transferred your WordPress site files from Plesk to your Vultr Server, configure the necessary DNS records, and generate SSL certificates to redirect all user traffic and activate WordPress on the server

Configure DNS Records

Depending on your domain registrar, you do not need to change nameservers, unless hosted by the same cPanel or Plesk provider. Instead, you need to change the domain records to point to your Vultr Server which handles all client requests. In this section, configure your DNS records to point to the new WordPress server as described in the steps below.

  1. Log in to your domain registrar such as eNomNamecheapCloudflareGoDaddy, among othersIf your domain registrar doubles as your hosting provider, migrate your domain to another registrar such as Cloudflare and change your nameservers to: ns1.vultr.com ns2.vultr.comTo effectively use the above Vultr nameservers, log in to the Vultr customer portal, and add the domain name to link to your Vultr account.
  2. Find and click your domain name to open the DNS records
  3. On the DNS records page, find and edit the domain A recordChange a Domain A Record
  4. Change the IPV4 Address to your Vultr WordPress server’s public IP Address
  5. Wait for the DNS propagation to complete, when using Vultr DNS, changes should reflect in less than 3 hours.

If you have email accounts linked to your WordPress site, set up a mail server and change the domain MX records to point to the new server.

Generate SSL Certificates

To enable HTTPS access and redirect HTTP requests on your WordPress site, generate SSL certificates for your WordPress site domain. In this section, use the free Certbot Let’s Encrypt Client tool to request a new SSL certificate for your domain as described below.

  1. Verify that Certbot is available on the server $ sudo certbot --version

When unavailable, install Certbot using the Snap package manager

    $ sudo snap install certbot --classic
  1. Generate an SSL certificate for your WordPress domain name. Replace example.comadmin@example.com with your actual domain and active email address respectively $ sudo certbot --nginx -d example.com -m admin@example.com
  2. Verify that Certbot auto-renews your SSL certificate upon expiry $ sudo certbot renew --dry-runWhen the command is successful, Certbot auto-renews your SSL certificate every after 90 days.

Test Your WordPress Site

  1. Using a web browser such as Firefox, visit your WordPress site https://example.com
  2. Verify that your site loads correctly without any errors
  3. Log in to the WordPress administrator dashboard https://example.com/wp-admin
  4. Navigate to Tools and select Site Health from the drop-down list.
  5. Click Info, and expand the Server drop down to view information about your WordPress server. Verify that the values change compared to your previous WordPress server details.WordPress SiteHealth Information
  6. Click to expand File Permissions and verify that all directories are writable
  7. Expand Database to view your MySQL database details. Verify that the new database and user you created earlier appear on the list
  8. Your WordPress site is ready to use. You can safely add new posts, pages, or WooCommerce elements that load directly from your new WordPress server

Troubleshooting

The WordPress migration process should return no errors, nor should the site users detect any changes while using the site. But if in any way your WordPress site returns any error, fix it as defined in the steps below

503 Service Unavailable

  1. View the web server logs to find the exact source of the error $ sudo cat /var/log/nginx/error.log
  2. Verify that PHP-FPM is running correctly without any errors. $ sudo systemctl status php-fpm
  3. Verify that the Nginx configuration returns no configuration errors $ sudo nginx -tOutput: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
  4. Verify that the Nginx web server is running correctly without any error $ sudo systemctl status nginxOutput: ● nginx.service - A high-performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-07-27 13:46:34 UTC; 1 month 1 day ago Docs: man:nginx(8) Main PID: 101326 (nginx)

Error Establishing a Database Connection

  1. Navigate to your WordPress webroot directory. $ sudo cd /var/www/example.com
  2. View the contents of the wp-config.php file and verify that they match your WordPress user and the database you created earlier $ cat wp-config.php
  3. Log in to the MySQL database using the WordPress user in your wp-config.php file $ mysql -u adminuser -p
  4. Verify that the user has access to the WordPress database mysql> SHOW DATABASES:The WordPress database should display in your output:
  5. Exit the MySQL console mysql> EXIT
  6. View the list of installed PHP extensions on your server, and verify that the mysqli extension is available on the list $ php -mOutput: [PHP Modules] mbstring memcached msgpack mysqli mysqlnd openssl pcntl

Insecure Connection

  1. Using Certbot, generate a new Let’s Encrypt SSL certificate. Replace example.com with your actual domain name. $ sudo certbot -d example.com -m adminuser@example.com --agree-tosVerify that the SSL certificate installs correctly to the server. If it fails, verify the DNS propagation is complete, and the ports 80, 443 are open on the server firewall.
  2. View the UFW firewall table $ sudo ufw status
  3. Allow the HTTP and HTTPS ports if they’re missing $ sudo ufw allow 80,443/tcp
  4. Restart the firewall to save changes $ sudo ufw reload
  5. Test auto-renewal to verify that the certificate renews upon expiry $ sudo certbot renew --dry-run

404 Not Found

This error occurs when the web server does not have read privileges on your WordPress web root directory. Or, reset WordPress permalinks in the administrator dashboard to correct your post and page URLs. To grant the Nginx web server correct privileges to WordPress files, follow the steps below.

  1. Switch to the Nginx sites-available directory. $ cd /etc/nginx/sites-available/
  2. View the WordPress virtual host configuration $ cat example.com
  3. Verify that your WordPress host configuration file points to the correct webroot directory, and index.php is available on the index list root /var/www/example.com; index index.php index.html;
  4. View the web root directory permissions $ ls -l /var/www/example.com
  5. Grant the web server ownership permissions to the directory $ sudo chown -R www-data:www-data /var/www/example.com
  6. Restart Nginx to apply changes $ sudo systemctl restart nginx
  7. Visit your WordPress site and verify that it loads correctly without the error https://example.com
  8. If the error persists, view the Nginx error.log to find the exact source of the error $ sudo cat /var/log/nginx/error.log

Conclusion

In this article, you migrated your WordPress site from cPanel or Plesk to a Vultr server. Depending on your source hosting environment, your website users may not notice the change while migrating your WordPress site. This means, your WordPress site must not experience any downtime. However, notable differences in the WordPress site speed, ranking, and reliability reflect when you make the change.

Introduction WordPress migration is an important task that allows you to shift from one provider to another. Usually, when you experience site performance issues linked to underlying infrastructure performance, migrating your site to a new host can improve your general site reliability and ranking. In a shared hosting environment, cPanel…

Introduction WordPress migration is an important task that allows you to shift from one provider to another. Usually, when you experience site performance issues linked to underlying infrastructure performance, migrating your site to a new host can improve your general site reliability and ranking. In a shared hosting environment, cPanel…

Leave a Reply

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