How To Move WordPress From Cpanel to VestaCP Successfully

Move WordPress From Cpanel to VestaCP

Background

Cpanel from cpanel.net is the most popular, proven and robust web hosting platform out there. For both not technical and slightly technical, it simplifies the job a lot. It even has a free script installer as well as many paid for auto script installers such as softaculous.

Other notable features are email, database and file management on top of robust web statistics aggregation. If you are hosting one or two websites in a shared host environment this is what you need absolutely. Most hosting providers, for example, Godaddy, Bluehost to mention but a few won’t charge you extra for it.

But if you’re a small and startup hosting provider it might require a huge investment as well as unnecessary expense. Say you host your websites in the cloud, dedicated and normal VPS servers, you have to spend $20 to $40 per month on Cpanel. If you’re smart and a good researcher you may look out for discount coupons and if you’re lucky enough,  you will land on buycpanel.com from which you can get VPS licenses from as low as $13.95.

Did I mention setting it up, requires a professional or an experienced person like me for example? Setting up Cpanel requires you to choose the correct operating system usually CentOS and as of writing this article you CentOS7 and above versions are a must, since Cpanel announcement that it will be stopping support for CentOS 6 on all systems by November 30, 2020. If you install FTP, SSH, and exim services you won’t get away with your junior skill.

Of course, there’re many individuals and agencies including CPanel support who offer the installation and hardening service at a certain fee.

If you are in a scenario like mine, you would realize going through all the above jargon is time-consuming and expenditure is overkill.

My scenario

I technically manage one of the most read news blog websites in Uganda. These are two websites which run on a single cloud KVM VPS at linode.com. Both websites get around a monthly traffic of 250k. Both websites are four to five years old.

Technically I’m the single person in a number of publishers. For simplistic, the websites are proudly powered by WordPress which is slightly customized with custom fields, themes, and plugins.

My primary role is to manage the server and carry out routine security audits, performance, theme optimization, update WordPress and plugins. We also slightly handle emails on the server. But we don’t want to spoil our sender score or reduce the reputation of the IP of our server.

We’ve had Cpanel on our node for the last two years, despite being in a tight third world economy.

For some months the license was automatically deactivated due to our failure to submit a payment, throughout that duration we couldn’t access Cpanel support, then it became hard to make any code modifications, manage databases and email accounts.

During that time the only way of getting in the server was via ssh but we didn’t know every command, for example, to carry out a slight firewall fix.

Proposal

For regular management of the server, we had to find a solution. Thus we researched about website/web host control panels. We would filter by fees in relation to Cpanel, features, support, and age of first version and latest version.

One of the most interesting ones we came across was CentOs CP which looks so much like Cpanel but we settled for another.

Choosing VestaCP

  • It’s Opensource and free.
  • It supports more than one Linux distributions namely; Centos, Debian, Redhat, and Ubuntu. We actually installed it on CentOS7 but I later found out Ubuntu is recommended.
  • It’s minimum requirements i.e 1GM RAM, 20GB storage are friendly and can translate to slightly better performance than Cpanel.
  • Installation of VestaCP is the easiest yet takes as much as 15 minutes to be ready to set up and manage your websites.
  • To manage backups, databases, and emails is almost as simple as if not easier than Cpanel.
  • It has a growing support community through forums and paid for support.
  • File management. VestaCP doesn’t offer a free file management feature but that wasn’t big of an issue. The developers at VestaCP offer a file management plugin which is at $3 per month or $50 for a lifetime. We can also choose to use services such as codeanywhere.com to connect to the server via FTP hence manage our files without pain. Though codeanywhere.com has both free and paid plans, free code editors such as Notepad++, Atom, and Microsoft VS Code can connect to the server via FTP by the help of secure plugins and allow you to manage files of your websites. For us, this is great. It will help us save more than $179.5 which is a minimum of 661,986/= in Uganda Shillings currency today without including transaction fees.

Procedure of Switch

Order a second node from linode.com

One of the sites is about 51GB in files(images contributing the biggest part) and 1GB for MySQL database. As much as I wanted to use a WordPress backup plugin especially duplicator. The PHP execution time and memory limit couldn’t enable the plugin to execute and complete successfully. I also didn’t use the Cpanel backup feature because it was downloading the files locally on my computer which wasn’t what I desired.

What did I do?

I accessed both the older and newer nodes via ssh.

Older node.

Create a backup archive.

$zip backup.zip -r /public_html

The command took some time to finish about 2hours. I would be glad to discover a faster solution because moving systems around is just getting started.

The next command I used was for backing up the database.

$mysqldump -u root -p database_name > /home/user/path/database-file.sql

The dump was blazing fast, motivating me to continue.

Newer node.

  • Setup the node with CentOS7. Coming from Cpanel, I’m used to CentOS for web hosting.
  • Install VestaCP.
  • Create a site, FTP account, database.
  • Download backup from the older node and restore.

Download commands
Navigate to the path where I want to download backup files.

$cd /home/user/web/domain.tld/public_html
$wget http://domain-on-older-node.ltd/backup-path/backup.zip
$wget http://domain-on-older-node.ltd/backup-path/database-file.sql
  1. Restoring files
    While at the path where I downloaded the backup.zip file, issued the command below.
$unzip backup.zip

If the files to extract at the root of public_html directory like in my case, I used the move (mv) command to move the files to the right location.

2. Restoring database

$mysql -u database-username -p
$use database-name;
$source database-file.sql;

Provide the password as the system will prompt you, the restoration of the database took less than two minutes.

Troubleshooting Tips

1. I see a blank white screen when I visit the website

  • Check and verify that the .htaccess file was restored. If not copy it from the old node to the new node.
  • Increase the maximum execution time and memory limit. Which VestaCP can help you do without hunting down the PHP.INI file. Increased mine to 300 and 384 respectively. By the way, I made the setting server-wide because am sure, I will be the only person to create websites on this server.

2. Unable to upload photos through the media library.

This is caused by a file permission issue. You have to make sure that the website account owns the WordPress installation since by default website installations are owned by root. Use the command below.

$chown -R username:username /home/username/web/website.com/public_html

Note: replace username with the actual username of the account under which website.com belongs. The website path structure in VestaCP is like /home/username/web/website.com/public_html

3. The uploaded file could not be moved to /wp-content/uploads/year/month

This is also a file permission problem on the uploads directory, you should make sure user and group can all write to this directory. Which you have to fix using the command below.

$chmod -R 777 /home/username/web/website.com/public_html/wp-content/uploads

Conclusion

I would have moved the websites in less than 6 hours but because it was my first time doing this, I didn’t have experience of what I experienced during the process. I was playing trial, error and referring to  Google.

I believe this is going to help you and I get a lot of local businesses online by offering them a cheaper performant alternative.

Will also get web developers, online without having to cough more than $5USD per month for a robust node.

Curiosity

Does VestaCP work with docker? How can it be set up? How is the performance?

PS: This article was originally authored by David Wampamba at Fiction To Actual.

Kwehangana Hamza

cms-africa-kigali

I am a digital content designer and publisher working with a top digital agency in Kampala, Uganda. I started blogging out of my passion for learning & sharing.

Through this blog, I share tech and digital tips i’ve uncovered and hoping they be of great value to you.

Next Appearance

Hamza-Wordcamp-2017

WordCamp Kampala 2018
I am glad to be selected among the speakers at this year’s WordCamp, Kampala.
The 3-day event will take place from the 23rd – 25th November 2018 and I will be sharing on the topic: Secrets To Achieve Sustainable Income Blogging with WordPress.
If you’ll be around Kampala, be sure not to miss out.