Many bloggers launch their sites with shared hosting. This may be good to start out. But you should move your blog to a personal cloud server once you start getting enough traffic to your site. This will boost your performance and give you more options for the type of web server your use. In this tutorial, we show you how to migrate your site from a cPanel account to an Ubuntu or Debian VPS/Cloud Server running EasyEngine.io Nginx, PHP 7, MySQL, and Redis Cache. Check the http://easyengine.io/ site for server OS version requirements.
Migrating to an EasyEngine.io VPS/Cloud Server isn’t complicated. Just follow these steps and you can migrate a WordPress blog/website within 2 hours, without any downtime.
NOTE: SpectroHost.com will migrate your website for you with a 6-month order for any Cloud Server at no additional cost. Send a ticket to support once you have completed your Cloud Server order and we will migrate your website for you to an EasyEngine.io, WHM cPanel server, or VestaCP Control Panel server for free.
A) Login to your current cPanel account to download a backup of your site.
B) Take a backup of your existing site database and code folder. Make sure to create a backup of all of your files, along with the MySQL database before migrating your site from shared hosting server to your new Easy Engine VPS/Cloud Server.
C) i) Take backup of code in the form of tar.gz file of code folder in the public_html in File Manager.
ii) Now take a backup of the database. You can export SQL file directly via PHPMyAdmin if the size of SQL file is less i.e., a few MBs.
iii) If your site DB size is in hundreds of MBs or GBs, it’s better to take MySQL dump via Command Line Interface (CLI). Use the below command to take MySQL backup through CLI:
mysqldump -u MYSQL_USER -pMYSQL_PASS DATABASE_NAME > DATABASE_NAME.sql
If you do not have ssh cli access to the cPanel account and the DB size is too large for PHPMyAdmin to download the SQL dump backup file, you will need to contact your web host’s tech support to do it for you.
Note: It would be better to store this file in public_html/html etc in order to include in tar.gz backup file.
Step 2- Install EasyEngine
A) To install EE, First, log in to your server via putty third party application PuTTY if you run windows. For Linux and MacOSX you can use a terminal program and login with your root credentials to your VPS/Cloud Server:
i) Enter the IP address of the server in PuTTY then click on OPEN.
ii) It will ask for the username and password.
iii) Enter the root credentials and login to the server.
iv) Now you’re ready to install the EasyEngine.
B) Install EE using command
|wget -qO ee rt.cx/ee && sudo bash ee; source /etc/bash_completion.d/ee|
C) After installing EE, install its stack by using the command:
ee stack install
This command will install all the required packages in one go. If you don’t want to install all packages then you can install single packages by using the following commands.
Install PHP 7.0
Install MariaDB MySQL
We recommend you install, Redis and PHP 7 for the best performance.
D) This step is optional but useful for the GUI administration of MySQL DB’s with PHPMyAdmin. Now, install all Admin tools like PHPMyAdmin and note down HTTP Authentication password for PHPMyAdmin directory. By default its username is easy engine. Use the following command for installing admin tools:
ee stack install –admin
E) Now install php7 by using the command as given below
|ee stack install –php7|
Step 3: Create a website
A) Create a site by using the command as given below. Replace example.com with your WordPress domain.
ee site create example.com –wpredis –php7
EasyEngine will automatically create a database for this new site and will set username/password to MySQL for the new domain name (example_com) by default.
Your website is created now.
It will show the result as follows:
|Creating example.com, Please Wait…
Creating Symbolic Link For example.com
Creating htdocs & logs Directory
Creating Symbolic Link For Logs
Downloading WordPress, Please Wait…
Enter The MySQL Database Name [example_com]: example_com
Enter The MySQL Database Username [example_com]: example_com
Enter The MySQL Database Password [73kWK4MpRiXjuvo]:
Setting Up WordPress, Please Wait…
Updating WordPress Permalink, Please Wait…
Installing Nginx Helper Plugin, Please Wait…
Reloading Nginx Configuration, Please Wait…
Configuration In Git Version Control…
WordPress Admin Username: admin
WordPress Admin Password: HelloExample
Successfully Created New Website: http://example.com
Note: Here, we’re using Nginx, PHP 7, and WP Redis cache. You can also install WordPress or use EasyEngine for other PHP MySQL CMS websites or HTML CSS sites. You can choose to use no-cache or use another cache of your choice as per your requirement (such as Nginx FastCGI cache or Memcached).
Step 4: Copy Webroot
As the website “example.com” is ready on a new server but we need the old server data to launch a new website successfully.
A) Upload the (code) tar file (tar file downloaded from the shared server) to the document root on the EasyEngine cloud server which is /var/www/example.com/htdocs/ via SFTP/FTP with the help of FileZilla client.
B) Now extract the backup (tar.gz) file that you’ve uploaded on the EasyEngine server. You can use the below command from ssh cli to extract the tar.gz file.
tar -zxvf backupfilename.tar.gz
C) The next step is to upload the .sql file to the new server via FTP/SFTP which you’ve downloaded from the shared server. Now import the .sql file into the DB created by EasyEngine e., done from root ssh cli
|mysql example_com < domain.sql|
D) Now fix paths on the DB with wp-cli. i.e., within ssh root cli on the EasyEngine server while inside /var/www/example.com/htdocs/:
E) Replace the full server path to the site’s documents root in the DB from the old shared server path to the new EasyEngine server path.
|wp search-replace ‘/home/exampleuser/public_html/’ ‘/var/www/example.com/htdocs/’ –allow-root –dry-run|
F) Once done, commit the changes by removing –dry-run:
|wp search-replace ‘/home/exampleuser/public_html/’ ‘/var/www/example.com/htdocs/’ –allow-root|
To test your site on the new server before you update DNS and start troubleshooting if any issue arises you should change your workstation hosts file and save the EasyEngine server IP address and website URL into the hosts file.
This page shows you how to do this for Windows, MacOSX, and Linux:
You should clear your DNS cache on your workstations and clear browser cache. Now browse to your website URL as you would normally – it will show you the website at the EasyEngine server. Once you verified the site is working as expected, remove the entry from your hosts file on your workstation.
Make sure to update DNS for your existing IP address with the new IP address of your new server. You just need to wait for DNS to cache through the web and propagate. Now your site should be up and running on your new server with EasyEngine setup.