服务器环境
DigitalOcean VPS , CentOS 7 + LNMP
WordPress 已经有众多加速插件, 效果都还不错. 大多采用生成静态页面文件的方式. 对数据库的加速能力有限.
Redis 是一种内存数据库, 用它为 mysql 做缓存, 可有效加速数据库查询速度.
服务器环境
DigitalOcean VPS , CentOS 7 + LNMP
WordPress 已经有众多加速插件, 效果都还不错. 大多采用生成静态页面文件的方式. 对数据库的加速能力有限.
Redis 是一种内存数据库, 用它为 mysql 做缓存, 可有效加速数据库查询速度.
CentOS 7 与前代相比有了巨大改变, 服务管理器, 时间设置等等, 对于习惯了前代版本的人来说还是需要时间适应的.
下面讲一下如何从头配置 CentOS 生产环境, 以 DigitalOcean 云主机为例, 有关此云主机的介绍 请点这里
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="false" /> <defaultDocument> <files> <clear /> <add value="index.php" /> <add value="Default.aspx" /> <add value="Default.htm" /> <add value="Default.html" /> <add value="Default.asp" /> <add value="index.pl" /> <add value="index.htm" /> <add value="index.html" /> </files> </defaultDocument> <rewrite> <rules> <rule name="wordpress" patternSyntax="Wildcard"> <match url="*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> <httpErrors errorMode="DetailedLocalOnly" /> </system.webServer> </configuration> |
Magento 默认不会显示错误提示, 通常会显示一个空白页. 若要启用 Magento 的调试模式, 有两种方式:
1 | SetEnv MAGE_IS_DEVELOPER_MODE TRUE |
如图
1 2 3 4 | if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { Mage::setIsDeveloperMode(true); } |
将外面的 if 判断注释掉, 保存即可. 如下所示.
1 2 3 4 | #if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) #{ Mage::setIsDeveloperMode(true); #} |
对于Magento 版本1.4.1.1版本来说,可能会导致产品无法添加到购物车页面,提示错误cannot add item to shopping cart。
这个错误会在如下的条件下产生
1 客户没有登录( The user is not logged in)
2 商店设置了购物车打折规则(There is a shopping cart rule)
3 使用非Magento默认的支付方式 (There are only non default Magento payment methods).