How to Move Magento to a New Server or Domain
Magento is one of the fastest growing eCommerce platforms on the internet and with its recent acquisition by eBay it promises to stay on the lead and keep growing with even faster pace than before. It’s been choice for a platform for many of my clients and recently I had to do some development work on one of the websites. The shop was running Magento 1.7 and was on a dedicated CentOS server.
Move Magento to different domain/subdomain
I had to copy the live site in a development environment do the changed and move back to the live instance. The structure was as follows:
|
1
2 3 4 5 |
Live instance: domain.com
Path: /var/www/vhosts/live Dev Instance: dev.domain.com |
so to start first I moved across all of the files from live to dev:
|
1
|
# cp -r /var/www/vhosts/live/* /var/www/vhosts/dev
|
Next step was creating database for the development instance. First create your database in MySQL
|
1
|
CREATE DATABASE magento_dev;
|
Then you can copy the live one to the dev with one simple command:
|
1
|
# mysqldump -umagento -p magento_live > mysql -umagento -p magento_dev
|
OK so far so good we have the code base and the database ready next step would be changing the configurations of the development build so it uses the correct database connection. This step is very important and you should make sure that you dev build is not connected to your live database because this will mess the things up really bad.
The configuration file in our dev build is under:/var/www/vhosts/dev/app/etc/local.xml there you have to edit the following lines:
|
1
2 3 4 |
<host><![CDATA[HOSTNAME]]></host>
<username><![CDATA[USER]]></username> <password><![CDATA[PASSWORD]]></password> <dbname><![CDATA[DATABASENAME]]></dbname> |
And those should have values according to your database and user in our case that was:
|
1
2 3 4 |
<host><![CDATA[localhost]]></host>
<username><![CDATA[magento]]></username> <password><![CDATA[OuRSTR0NgP455W0RD]]></password> <dbname><![CDATA[magento_dev]]></dbname> |
Once the database connection is established you have to change the base URL of the shop. There are two specific rows that needs to be updated and they should be in your config table: core_config_data
|
1
2 |
UPDATE core_config_data SET VALUE = "http://dev.domain.com" WHERE path = "web/unsecure/base_url";
UPDATE core_config_data SET VALUE = "http://dev.domain.com" WHERE path = "web/secure/base_url"; |
In our case the secure and insecure URLs are both the same but if you have HTTPS already set for the new domain you can change the second query to match your existing URL. We are almost done but most likely our shop still wont work and the reason for that is the Magento magical cache. You have to delete all file and session cache.
|
1
2 |
# rm -fr /var/www/vhosts/dev/var/cache/*
# rm -fr /var/www/vhosts/dev/var/session/* |
So that is all you can now start using you new shop. If you have problems logging in to Magento back-end because you don’t know the admin password you can restart Magento admin password.
Move Magento to another host
This is almost the same process but you need to compress the files and move them across to the other server.
First we have to export our database:
|
1
2 |
# cd /var/www/vhosts/live
# mysqldump -umagento -p magento_live > magento_live.sql |
After that move to the root folder that contains all of the live build files and archive it with tar ball
|
1
|
# tar -zcvf magento_live_bck.tar.gz /var/www/vhosts/live/*
|
This archive should contain all of the Magento files and the database dump. Next step is copying the archive across to the other server:
|
1
2 3 4 |
# scp /var/www/vhosts/magento_live_bck.tar.gz root@other.server.com:/var/www/vhosts/live
# root@other.server.com # cd /var/www/vhosts/live # tar -zxvf magento_live_bck.tar.gz |
Once you have moved the files across all you have to do is import the database and do the steps mentioned above for the domain move.
Other issues with Magento blank screen
If you get blank screen check your php error log and enable your error printing by putting this into index.php
|
1
2 |
// index.php
error_report(1); |
Here is a solution of error that I go: Broken local XML
|
1
|
Call to a member function extend() on a non-object in httpdocs/lib/Varien/Simplexml/Config.php on line 600
|
Other than that you should make sure you have all needed PHP extensions installed on the server for example mbcrypt.
And last but not least is to check your .htaccess file and if needed update theRewriteBase tag to point to your root directory on your server.
How to Move Magento to a New Server or Domain的更多相关文章
- Importing Product Images on Magento
Multiple product images of each type can be imported into Magento, and associated with a specific pr ...
- The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator
今天遇到一个案例,在使用命令修改一个测试服务器(SQL Server 2014标准版)的服务器排序规则时,遇到了下面错误信息 (具体账号信息脱敏处理,随机生成一个账号密码) The Windows a ...
- [转]How to speed up Magento 2. Maximum Performance
本文转自:https://magedirect.co/how-to-speed-up-magento-2-maximum-performance/ Introduction In this artic ...
- SQL Server 2012 无人值守安装(加入新实例)
方法1,通过指定条个參数安装 setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEA ...
- Microsoft SQL Server Version List [sqlserver 7.0-------sql server 2016]
http://sqlserverbuilds.blogspot.jp/ What version of SQL Server do I have? This unofficial build ch ...
- Microsoft SQL Server Version List(SQL Server 版本)
原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Servic ...
- SQL Server 2012 无人值守安装
方法1,通过指定条个參数安装 setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /F ...
- Problem with WinRM on Exchange 2013 Management Shell and Exchange Toolbox on a new exchange 2013 with CAFE and BE on single server installation
While deploying MS Exchange 2013 I experienced issues with accessing the Exchange Management Shell a ...
- 利用Ring Buffer在SQL Server 2008中进行连接故障排除
原文:利用Ring Buffer在SQL Server 2008中进行连接故障排除 出自:http://blogs.msdn.com/b/apgcdsd/archive/2011/11/21/ring ...
随机推荐
- Android SDK Manager无法更新,内容显示不全的解决办法
最近在初学android开发,在更新SDK的时候遇到了麻烦. 发现Extras文件夹下为空,没有内容,包括sdk列表也不全面,更新也没有反应 解决方法: 1.在SDK Manager下Tools-&g ...
- BZOJ4377 : [POI2015]Kurs szybkiego czytania
因为$a$与$n$互质,所以对于$0$到$n-1$里每个$i$,$ai\bmod n$的值互不相同. 设匹配成功的起点为$i$,那么可以得到$3m$段$ai\bmod n$的值不能取的禁区,每段都是连 ...
- BZOJ3829 : [Poi2014]FarmCraft
d[x]表示走完x的子树并回到x所需的时间 f[x]表示从走到x开始计时,x子树中最晚的点安装完的最早时间 d[x]=sum(d[i]+2),i是x的孩子 f[x]的计算比较复杂: 考虑将x的各棵子树 ...
- javascript中字符串常用操作总结、JS字符串操作大全
字符串的操作在js中非常频繁,也非常重要.以往看完书之后都能记得非常清楚,但稍微隔一段时间不用,便会忘得差不多,记性不好是硬伤啊...今天就对字符串的一些常用操作做个整理,一者加深印象,二者方便今后温 ...
- Google Code Jam 2010 Round 1C Problem B. Load Testing
https://code.google.com/codejam/contest/619102/dashboard#s=p1&a=1 Problem Now that you have won ...
- 验证标题是否存在(TextBox控件失去焦点验证)
首先解释两个属性, AutoPostBack 属性用于设置或返回当用户在 TextBox 控件中按 Enter 或 Tab 键时,是否发生自动回传到服务器的操作. 如果把该属性设置为 TRUE,则启用 ...
- nginx源码编译安装
安装编译所需的包: [root@xaiofan ~]# yum install -y gcc gcc-c++ autoconf automake 安装nginx使用某些功能需要的包: [root@xa ...
- 提取数据用strpos函数比较,预期和实际不符问题解决
在我提取数据时,数据是一串字符串,第一个数据和要比较的字符是相等的可是却是相反的结果 . 测试if(0==false)结果如图 执行结果 说明0和false相等.我的程序开始是这样的 第一个数据是正确 ...
- Codeforces Round #360 (Div. 2) C D E
每次AB秒出 到了C难度陡然上升...翻译都弄不懂... C 给出一张图 找出两个点的覆盖集(覆盖集是指这图中每条边都有至少一个点在这个点集里面) 并且两个点集没有交集 英文很难看懂...就是二分图的 ...
- 返回指定的VC
for (UIViewController *controller in self.navigationController.viewControllers) { if ([co ...