博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
magento提速!!!!
阅读量:4201 次
发布时间:2019-05-26

本文共 3051 字,大约阅读时间需要 10 分钟。

   
1、安装Fooman Speedster插件
插件官方地址:
这款插件主要通过合并、压缩js和CSS来加速,不知道这个和使用Magento自带的合并功能有什么区别。
2、在.htaccess中开启Gzip压缩
在.htaccess的52行左右的位置移除#号
  1. #php_flag zlib.output_compression on
复制代码
将以下.htaccess
  1. ############################################
  2. ## enable apache served files compression
  3. ## http://developer.yahoo.com/performance/rules.html#gzip
  4.     # Insert filter
  5.     #SetOutputFilter DEFLATE
  6.     # Netscape 4.x has some problems...
  7.     #BrowserMatch ^Mozilla/4 gzip-only-text/html
  8.     # Netscape 4.06-4.08 have some more problems
  9.     #BrowserMatch ^Mozilla/4\.0[678] no-gzip
  10.     # MSIE masquerades as Netscape, but it is fine
  11.     #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  12.     # Don't compress images
  13.     #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  14.     # Make sure proxies don't deliver the wrong content
  15.     #Header append Vary User-Agent env=!dont-vary
  16. </IfModule>
复制代码
把一些#号去掉
  1. ############################################
  2. ## enable apache served files compression
  3. ## http://developer.yahoo.com/performance/rules.html#gzip
  4.     # Insert filter
  5.    SetOutputFilter DEFLATE
  6.     # Netscape 4.x has some problems...
  7.     BrowserMatch ^Mozilla/4 gzip-only-text/html
  8.     # Netscape 4.06-4.08 have some more problems
  9.    BrowserMatch ^Mozilla/4\.0[678] no-gzip
  10.     # MSIE masquerades as Netscape, but it is fine
  11.   BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  12.     # Don't compress images
  13.     SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  14.     # Make sure proxies don't deliver the wrong content
  15.     Header append Vary User-Agent env=!dont-vary
  16. </IfModule>
复制代码
3、安装 APC or Xcache
APC -
Xcache -
apc使add to cart两秒内加载的方法
在你安装激活apc之后,找到app/etc/local.xml 文件
在<global>下添加如下block
  1. <global>
  2. ....................
  3. <cache>
  4. <backend>apc</backend>
  5. <prefix>alphanumeric</prefix>
  6. </cache>
  7. ......................
复制代码
以上需要注意的是如果你的服务器有超过一个Magento程序,apc在缓存上会有一些混乱
可以试着使每个Magento网站<prefix>alphanumeric</prefix>内容不同
第一个网站<prefix>siteA</prefix>
第二个网站<prefix>siteB</prefix>
提速的重点在于成功安装apc
4、修改Mysql服务器的配置好好利用服务器的内存
绝大部分Linux发行版提供一个保守的mysql包来确保能运行在大范围的硬件上。如果你有足够的内存(比如,1gb或者更多),接着你可能会想调整设置。一个my.cnf的示例如下,
  1. key_buffer = 512M
  2. max_allowed_packet = 64M
  3. table_cache = 512
  4. sort_buffer_size = 4m
  5. read_buffer_size = 4m
  6. read_rnd_buffer_size = 2m
  7. myisam_sort_buffer_size = 64m
  8. tmp_table_size = 128m
  9. query_cache_size = 96m
  10. query_cache_type = 1
  11. thread_cache_size = 8
  12. max_connections = 400
  13. wait_timeout = 300
复制代码
5、Magento缓存
转到Magento admin->system->Cache management
选中以下条目:
-- Configuration
-- Layouts
-- Block HTML output
-- Translations
以下条目就不用选中了
-- Collections Data
-- EAV types and attributes
-- Web Services Configuration
6、开启编译
转到System > Tools > Compilation,报道称能给你提速25%-50%。
7、使用cdn加速
你可以使用Magento插件来帮助你
其他关于前端模板代码方面的优化如图片优化、使用CSS Sprite等论坛其他帖子。
以上方法整理来源于以下网站:
8. 将magento的var目录挂载到内存中,加快读取速度,如
mount -t tmpfs -o size=100M,mode=0777 tmpfs var
9. 打开apache的KeepAlives,可以让多个请求使用一个TCP连接,加快速度
修改/etc/httpd/conf/httpd.conf: KeepAlive On
10. Magento1.5中可以开启CSS和JS合并
SYSTEM -> CONFIGURATION / ADVANCED -> DEVELOPER
enable
Merge JavaScript Files set to Yes
Merge CSS Files set to Yes
11. 增加PHP Memory Limit
如果2G内存,可以通过修改php.ini 将memory_limit设置为128MB

转载地址:http://oicli.baihongyu.com/

你可能感兴趣的文章
JAVA实现文件树
查看>>
Drools 规则引擎
查看>>
OLTP和OLAP区别
查看>>
JMeter最常用的三种类型的压力测试
查看>>
Hibernate HQL 语法大全(上)
查看>>
深入Java事务的原理与应用
查看>>
CSS单位和CSS默认值大全
查看>>
交大我来了--周末再见了
查看>>
网页中flash wmode属性
查看>>
挑战自我,勇攀高峰
查看>>
神奇的HTML5画图应用
查看>>
flex 滚动条问题
查看>>
软件开发管理中的博奕论
查看>>
计算机认证考试种类
查看>>
SQL in和exists 比较
查看>>
社会性网络服务(SNS)研究
查看>>
鼠标DarkField技术
查看>>
傻傻的我
查看>>
paypal 沙盒账号注册
查看>>
ebay 沙盒账号注册
查看>>