Redirect9.Com

Migrating a WordPress Website to VPS with CentOS Web Panel (CWP)

Migrating a WordPress website to a new location (VPS) involves the following steps: create website (new location), create database (new location), point DNS records (new location), zip-up/download website (old location), export database (old location), upload/unzip website (new location), import database (new location), edit wp-config.php for database (new location), address .htaccess issues and fix permissions/security issues in CWP.

The reason you want to go VPS is a big increase in speed. A cheapy (managed) VPS plan from Hostwinds.com is about the same price as a shared hosting plan or about $130/year. What you get is CentOS Linux. That's it. You'll need to install CWP which is easy but the configuration is a pain. I show you how to do that here . Note that the installation of CWP also brings PHP, MySQL, Apache and a lot more. 

Create New Website in CWP
In CWP, you don't just set up a website. First, you must set up a user along with a website at the same time. Subsequent websites get added as folders to this first website folder. 

My initial website is located here: /home/matt/public_html/
Added website: /home/user_name/public_html/new-website1.com
Added website: /home/user_name/public_html/new-website2.com

This is weird because all subsequent websites are folders under the first websites.

In order to add one or more additional websites in CWP: Domains, Add Domain, domain name (my-new-website.com) in Add Domain field, select user, Folder Path:
/public_html/my-new-website.com, select AutoSSL.

Create New Database CWP
Get the name of the database from your wp-config.php. Go into myPHPAdmin via your new CWP. Click on the Databases tab at the top in order to add a new database at your new location.

Point DNS Records to New Website
I discuss how to do that  here . Here's a video on setting up your DNS records at Cloudflare.

Download WordPress Files
Select all the folders and files in the main WordPress directory. Zip up and download your current WordPress website. Note the .htaccess file in the main directory and make sure it gets downloaded too. If you can't see it then use FileZilla or similar FTP program to view and download it. 

Download MySQL Files
Before working with the database, please write down the following information from wp-config.php concerning MySQL settings: DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, You will need to note these settings in your new database.

You'll need to view the database with phpMyAdmin. Just go to the database section of your panel, like cPanel or CWP. In CWP go to SQL Services/phpMyAdmin. Click on phpMyAdmin. At the top you'll see the following tabs: Databases, SQL, Status, User Accounts, Export, Import, Settings, Replication, Variable, More. On the left side of the screen see a database tree. Click on the database you want to export, and then click on the Export tab. Click the Go button on bottom right. 

Upload MySQL Files
Click on this new database in the tree on the left side of the screen. Click on the Import tab at the top and Choose File. Import the .sql file that you had earlier exported.

Click User Accounts to add a new user. Give this user all privileges. 

You will need all of this information for your wp-config.php file. Edit your wp-config.php file with the updated database information.

Upload Website
Use the CWP File Manager to navigate to your new website.
   - Here: /home/user_name/public_html/
   - Or here: /home/user_name/public_html/new-website1.com

Upload zipped up website. Note the unzip symbol on the righthand side of the screen on the line of the zipped file. Go ahead and unzip it when able.

Done
If you need more help then watch this video. In theory you are done but there is a good chance your website won't come up. Below are the adjustments I had to make in order to get my WordPress websites running under CentOS and CWP.

Addressing Issues
Fixing Permissions and Security Issues in CWP
   - User Accounts => Fix permissions
   - Security => Mod Security: ModSec Profile - Comodo WAF.
   - Restart Apache Webserver.
Fixing .htaccess
   - Comment out everything with # for each line except the WordPress section. 
   - Start removing comments one section at a time to see which sections work.
   - I found one section on extra security that was causing a problem.