• 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
What's Hot

机械模具加工公司网站设计案例

24 10 月, 2023

快速原型公司案例

24 10 月, 2023

陶瓷加工网站案例

24 10 月, 2023
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram
VPSEO VPSEO
  • 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
VPSEO VPSEO
Home»Centos»magento 1.9 速度优化篇
Centos

magento 1.9 速度优化篇

chrispengcnBy chrispengcn7 8 月, 2021没有评论2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

网站速度优化和SEO一样属于营销的基本组成部分,常用的速度优化工具有:
– Pingdom Website Speed Test
– WebPagetest
– GTmetrix
– think with Google
– YSlow – Official Open Source Project Website
– Which loads faster?

– PageSpeed Insights

Magento实际上已经内置了一些优化的代码,下面我们以PageSpeed Insights来一一进行优化处理,这里Alan的一个站点初始分值Mobile为15分,Desktop为26分

PageSpeed Insights初始分值
1.Leverage browser caching
这项修改Mobile约提高21分,Desktop提高23分
首先进入System>Configuration>Developer修改JavaScript Settings和CSS Settings部分
Magento系统JavaScript和CSS代码合并

然后进入到.htaccess中修改如下版块(以下配置仅供参考,可根据实际情况进行调整)
1

2

3
############################################
4
## Add default Expires header
5
## http://developer.yahoo.com/performance/rules.html#expires
6
ExpiresActive On
7
ExpiresDefault “access plus 1 year”
8
ExpiresByType image/gif “access plus 1 month”
9
ExpiresByType image/png “access plus 1 month”
10
ExpiresByType image/jpg “access plus 1 month”
11
ExpiresByType image/jpeg “access plus 1 month”
12
ExpiresByType text/css “access 1 month”
13
ExpiresByType application/javascript “access plus 1 month”
14

15

设置的时间期限有:

years
months
weeks
days
hours
minutes
seconds

2.Enable compression
这项修改Mobile约提高13分,Desktop提高17分
1

2

3
############################################
4
## enable apache served files compression
5
## http://developer.yahoo.com/performance/rules.html#gzip
6

7
# Insert filter on all content
8
SetOutputFilter DEFLATE
9
# Insert filter on selected content types only
10
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
11

12
# Netscape 4.x has some problems…
13
BrowserMatch ^Mozilla/4 gzip-only-text/html
14

15
# Netscape 4.06-4.08 have some more problems
16
BrowserMatch ^Mozilla/4.0[678] no-gzip
17

18
# MSIE masquerades as Netscape, but it is fine
19
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
20

21
# Don’t compress images
22
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
23

24
# Make sure proxies don’t deliver the wrong content
25
Header append Vary User-Agent env=!dont-vary
26

27

以上两条优化后网站Mobile为49分,Desktop为68分
PageSpeed优化后

显然还有很大的优化空间

3.Eliminate render-blocking JavaScript and CSS in above-the-fold content

理论上在script标签里添加async或者将代码从head中向即可解决这一问题,,如未合并js前,可以添加params参数,如:
1
defer 2
async

实际上在Magento中这部分需要对代码进行相对比较大的修改,网上有一个插件,Alan在测试时并未带来分值上的提升,感兴趣的朋友可以试一下:

https://github.com/gaiterjones/magento-pagespeed
4.Optimize images

对于图片的优化可以使用如下网站对图片进行压缩,或者使用cdn存放图片对图片加载进行提速
https://tinypng.com/
http://www.tuhaokuai.com/

至于其它的Minify的建议,Google给出了自己的建议:

To minify HTML, try HTMLMinifier
To minify CSS, try CSSNano and csso.
To minify JavaScript, try UglifyJS. The Closure Compiler is also very effective. You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.

Google 官方的优化安装包:

https://developers.google.com/speed/pagespeed/module/

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
chrispengcn
  • Website

Related Posts

如何防止SSH命令中断 XshellPortable、putty、SecureCRT等断网造成Linux命令中断

30 6 月, 2023

linux zip分卷压缩解压命令

30 6 月, 2023

CentOS7 做 路由器 精简方法

11 12 月, 2022

mysql 运行 /tmp 空间不足解决办法

18 10 月, 2021
Add A Comment

Leave A Reply Cancel Reply

*

code

导航
  • 首页
  • 关于我们
  • 服务项目
  • 项目案例
  • 博客文章
  • 联系我们
博客
  • 服务器运维
  • 服务器安装
  • nginx
  • PHP
  • WordPress
  • Python
  • Javascript
  • SEO
  • 电子商务
  • 大数据采集
  • 宝塔面板
  • 数据库
  • 电子商务
  • 虚拟化
  • 阿里云
导航
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们
最新文章
  • 机械模具加工公司网站设计案例
  • 快速原型公司案例
  • 陶瓷加工网站案例
  • CNC数控加工日文网站案例
  • 触摸一体机数字标牌厂家网站案例
关于我们
关于我们

广州纬来科技有限公司
联系地址:广东省广州市番禺区富华中路富源二街18号合和大厦809

QQ : 13602156
Email : 13926026058@139.com
Contact: +86 13926026058

Facebook Twitter YouTube LinkedIn
© 2025 广州纬来科技有限公司 粤ICP备2023105857号-2
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们

Type above and press Enter to search. Press Esc to cancel.