When transferring your Magento website there are more than a few things that you need to worry about than downtime. Follow this detailed guide to help yourself transfer Magento store to a new server!
Prerequisites for this tutorial are:
- Having root access to both servers
- Having cPanel or knowledge on how to create virtual host on the new server
Step 1.
Notify store administrators
The first thing you want to do it notify Magento administrators to stop working on the store. Otherwise, things might get lost in the process.
Step 2.
Create account on new server
Keep the same username for user
Step 3.
Create new databases and users on the new server replicating settings from the old server
Find this data in your document root (on old server) for Magento within app/etc/local.xml
Step 4.
Backup public_html folder
To do this, go to your account
cd /home/username/ tar -zcvf archive.tar.gz public_html |
Step 5.
Dump database(s) from old server
Step 6.
Move archive.tar.gz, and databases to a new server
Use scp:
scp archive.tar.gz [email protected]:/home/username scp *.sql [email protected]:/home/username |
Step 7.
Import database backup
Step 8.
Configure new server public_html
1 2 3 4 | mv public_html public_html_backup Unarchive archive.tar.gz: tar xvfz archive.tar.gz Set privileges: chown -R username:username public_html Set public_html group to nobody: chown username:nobody public_html |
Step 9.
Create new subdomain and change your Magento install to load from this domain
From cPanel create subdomain: new.yoursite.com
From PhpMyAdmin edit database core_config_data and change yoursite.com to new.yoursite.com for path: web/secure/base_url
and web/unsecure/base_url
Step 10.
In case you are getting 500 error
Go into public_html dir, and run following two commands:
find . -type d -exec chmod 0755 {} \; find . -type f -exec chmod 0644 {} \; |
Step 11.
Make sure your website on new.yoursite.com works properly
Step 12.
Do DNS redirect
Run Rsync from current server to make sure all of your files (especially session) are in sync with the new server.
rsync -avz public_html/ [email protected]:/home/username/public_html/ |