Apache 利用浏览器缓存(内部)
我通过PageSpeed Insights获得以下信息: 但在我的Apache站点配置中,我有:Apache 利用浏览器缓存(内部),apache,caching,pagespeed,Apache,Caching,Pagespeed,我通过PageSpeed Insights获得以下信息: 但在我的Apache站点配置中,我有: <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html "access plus 1 seconds" ExpiresB
<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>
过期于
ExpiresDefault“访问加1秒”
ExpiresByType text/html“访问加1秒”
ExpiresByType文本/css“访问加2周”
ExpiresByType文本/javascript“访问加2周”
ExpiresByType应用程序/x-javascript“访问加2周”
ExpiresByType image/*“访问加2周”
mod_expires
已启用。
而且似乎有效,因为其他css、jpg、png。。。文件被缓存。但是一些js和css文件不是。我做错了什么
您可以在上尝试,我相信apache使用
表示js文件的应用程序/javascript
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我相信apache使用
表示js文件的应用程序/javascript
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感谢您的建议,但不幸的是,
应用程序/javascript
不起作用。看起来它确实起作用了。我现在从您的服务器获取这些标题:缓存控制:max age=1209600
,过期时间:2013年12月16日星期一16:19:24 GMT
,内容类型:application/javascript
是。但它应该抛出304响应(未修改),并抛出200 OK响应。所以缓存不起作用。谢谢你的建议,但不幸的是application/javascript
不起作用。看起来它确实起作用了。我现在从您的服务器获取这些标题:缓存控制:max age=1209600
,过期时间:2013年12月16日星期一16:19:24 GMT
,内容类型:application/javascript
是。但它应该抛出304响应(未修改),并抛出200 OK响应。所以缓存不起作用。