To migrate your website to one of our servers or to move your website from a shared to a cloud server, you can follow the below steps after SSH into the source server. You can contact us if you have any difficulty, we do the migration for free to our customers. If SSH is not enabled, you can follow the steps in the link:
https://my.aspirationhosting.com/knowledgebase/193/Obtain-SSH-Access.html
First, you will have to move the website files. For that, compress the document root using tar command. The document root is the folder where the website files for a domain are stored. For your primary domain, it will be the public_html directory and for addon and subdomains, you can find it from cPanel > Addon Domains/Subdomains.
user@server_1:~$ tar -cvzf public_html.tar.gz public_html
Options c for compression, v for verbose, z to use compression technique, f to specify the output file. The first argument is the destination path with the file name and the second one is the source folder.
Next copy the compressed file to the destination server using scp command or rsync.
user@server_1:~$scp -P 3879 public_html.tar.gz <username>@<aspiration_server>:public_html
OR
user@server_1:~$rsync-avuz-e”ssh-p3879″public_html.tar.gz <username>@<aspiration_server>:public_html
Now you will have to move the website. Before that, put the site in maintenance mode to ensure no orders are missed during migration.
Create a database dump using the below command and copy it to the destination server.
user@server_1:~$ mysqldump -u <user> -p <database> > <database>.sql
user@server_1:~$ scp -P 3879 <database>.sql <username>@<aspiration_server>:public_html
You will have to enter the database username and password. You will get it from wp-config.php for WordPress, local.xml or env.php in app/etc for Magento or settings.php in sites/default for Drupal.
Now at the destination server, we will have to unpack the files and restore them at the necessary location. If you already have a domain and want the new one as an addon, create one from cPanel > Addon Domains. Then, extract the files to that directory. If you want to restore the primary domain, then extract the files to that directory. You may want to consider backing the existing document root before extracting the files.
user@server_2:~$ tar -xvzf public_html.tar.gz public_html
Now, create a database and user from cPanel > MySQL Database Wizard. After that, restore the database using the below commands.
user@server_2:~$ mysql -u <new_user> -p <new_database> < <database>.sql
After the restoration is complete, edit the database configuration file and change the username and database names.
The restoration is almost complete and you can check the working of the site after removing the maintenance flag by adding a host entry in your system. You can refer the below link for that.
https://my.aspirationhosting.com/index.php?rp=/knowledgebase/1435/Add-a-Host-Entry.html
After verification, you need to change the nameservers to Aspiration Hosting or change the A records so that the domain points to the new server thus completing the migration.