Every entrepreneur wants to grow their business and develop their store in the future. But the fact is that almost all business start with a low budget start-up, therefore, they can’t afford much money for a well-developed server. Just after their business flourish, they may possibly make a hard decision for their online shops, which most run in the platform of Magento that it’s time to migrate Magento to new server. But it was not just because the benefit of former server is poor, the reason may be the necessity of upgrading server. Whichever the reason always results in the process of Magento store migration to new server, and this task is such an enormous challenge for everyone to take. This topic today will focus on how to move your online shop to a new server and possible mistakes while doing this.

First – take preparation before migrating your Magento store

The first thing comes to your mind will be the minimum requirements for your Magento store that new server can meets. Possibly you will need to set up your PHP or even install the missing extensions. You also need to prepare enough disk space of the new server to store a whole shop plus some extra space in case of necessity. If your new server can not meet the minimal requirements like this, you should probably think over your selection.

Backup and copy your store

Every preparation is done, now you are ready to do the process of migration Magento to new server, but you still need to be careful. Don’t rush doing anything, your shop is really valuable. That’s why you must remember to test the new server and the most important is backup and copy all of your data before switching to new server.

You begin with creating a website and a database for your Magento shop, then you can begin to backup and copy your database. To reduce the size of the backup files, you can add “exclude var/cache, var/full_page_cache, var/log, var/report, var/session” like this:

back up and copy Magento store

Or you can use more convenient method of adding this value to move your backup files to the new server:

back up and copy Magento store

After that, you have to unpack the backup and copy files on the new server:

back up and copy Magento store

Install all the backup and copy files in new server

The process of installation for the backup and copy files is through editing app/etc/local.xml then add the new database settings for it. There will be two variants that need changing access permissions:

1, The web server runs scripts representing the user owns the files. You need to set permission for this first variant like this

Install back up and copy files in new Magento server

2, The second variant runs scripts on behalf of another separate user, which allows the web server to save the files not belonged to it. That’s why it will have a difference value like:

install back up and copy files in new Magento server

Test your new moved Magento shop

Now you have done migrating your shop to a new server, but as your domain is still indicate the old server, you will need to add this line to your “hosts” file, locating in /etc/hosts for Unix system and C:\Windows\System32\Drivers\etc\hosts for Windows administration system:

1.2.3.4 yourdomain.com

In which, 1.2.3.4 is the IP of your new server and “yourdomain.com” refers to the domain of your Magento shop. After testing if this shop truly and properly works, you must delete this line in the file “hosts”.

You are ready to test your new migrated Magento shop. But you still need to be careful while checking if the transferred shop is actually working. Put on your customers’ shoes to understand their behaviours and reactions toward the new process of shopping. If everything goes fine and smoothly, you have done a critical test to make sure the migration is necessary.

Sync your shop data before fully migrate to new server

Everything goes according to your plan, and you are able to sync your data before the full migration. There are two crucial points you need to focus on for completing the process of migrating Magento shop to a new server:

  • DNS settings can’t be updated promptly, so switch your domain TTL time to as smallest as possible first. Never start the final phase of migration before the old TTL time has expired.
  • While you sync your data, the shop on your old server should be shut down.

In order to switch the old server off, turn cron off and enable the maintenance mode at touch/home/mageold/public_html/maintenance.flag. Then you can sync your data using rsync for speeding up the process:

Sync your shop data before fully migrate to new Magento server

Now you can upload the database to your new server

Sync your shop data before fully migrate to new Magento server

There may be a default change of access permission during the synchronization, so you should check and restore it. And don’t forget the important part – clearing Magento cache:

Sync your shop data before fully migrate to new Magento server

Turn on the cron tasks for the new server as well as change DNS setting so the domain will point to the new server. Because TLL time expires, traffic will be directed to the new server.

You have done the process of how to migrate Magento shop to new server. Always remember to have a backup copy file so you can be sure to rewind everything when things go worse.

-> You might as well as want to learn more about the migration to Magento 2, read the full series and understand The requirements of migration to Magento 2, The installation of Magento Data Migration Tool and The process of migration to Magento 2.

Author

1 Comment

  1. Damon Moats Reply

    Good work, its a very good tutorial though initially I had a bit issues in backup process, thankfully there’s a similar tutorial for transfering Magento to a new host on Magenticians, do check it out too. thanks again

Write A Comment