我使用PageSpeed Insights获得以下内容:
但在我的Apache站点配置中,我有:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType text/css "access plus 2 weeks"
ExpiresByType text/javascript "access plus 2 weeks"
ExpiresByType application/x-javascript "access plus 2 weeks"
ExpiresByType image/* "access plus 2 weeks"
</IfModule>
mod_expires
已启用。
似乎工作,因为其他css,jpg,png,...文件被缓存。但是有些js和css文件不是。我做错了什么?
答案 0 :(得分:4)
我相信apache使用 application / javascript代表js文件
ExpiresByType application/javascript "access plus 2 weeks"
如果你签入apaches mime.types text / javascript被注释掉了。
我还建议您考虑优化网站图片
http://itransformer.es/public/img/carrete.png is resized in HTML or CSS from 2135x1555 to 300x219. Serving a scaled image could save 561.5KiB (98% reduction).
http://itransformer.es/public/img/logo.png is resized in HTML or CSS from 608x99 to 500x81. Serving a scaled image could save 29.3KiB (33% reduction).
http://itransformer.es/public/img/carrete2.png is resized in HTML or CSS from 2000x298 to 1903x284. Serving a scaled image could save 3.7KiB (10% reduction).
http://itransformer.es/public/img/gplus.png is resized in HTML or CSS from 62x64 to 35x36. Serving a scaled image could save 1.9KiB (68% reduction).
http://itransformer.es/public/img/tw.png is resized in HTML or CSS from 62x64 to 35x36. Serving a scaled image could save 1.5KiB (68% reduction).
http://itransformer.es/public/img/fb.png is resized in HTML or CSS from 62x64 to 35x36. Serving a scaled image could save 1.0KiB (68% reduction).
它们是在目标网页上加载的一些大图像,并且真正减慢了第一次访问加载时间。确保当您查看页面时加载您关闭自己的浏览器缓存以模拟第一次进入的人。
祝你好运 Narimm