gzip 压缩的文件是否在服务器端缓存?
当使用 Gzip 压缩 css 和 js 文件时,压缩的 css 或 js 文件是否仍缓存在服务器中以便重新发送给其他访问者,或者是否需要为每个访问者甚至每个页面视图进行另一个压缩过程?
谢谢。
When using Gzip to compress css and js files, does the compressed css or js file remain cached in the server to be resent to other visitors or does it require another compression process for each visitor or even each page view?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
旧的 Apache 1.3 系列有选项:
这样做,但 Apache 2 的 mod_deflate 显然没有(http ://thinkvitamin.com/code/serving-javascript-fast/)。无论哪种方式,缓存文件的压缩版本都不是默认设置。特别是,1.3 系列会为每个请求创建和删除临时文件,效率低下。
如果您使用 Apache 2 并且想要预压缩 CSS 和 JS 以减少 CPU 负载,您的问题已在服务器故障上得到解答:https://serverfault.com/questions/131452/apache2-mod-deflate-static-content
The old Apache 1.3 series had options:
to do so, but Apache 2's mod_deflate apparently does not (http://thinkvitamin.com/code/serving-javascript-fast/). Either way, caching the compressed version of files is not the default. In particular, the 1.3 series would inefficiently create and delete a temp file for each request.
If you're using Apache 2 and you want to pre-compress your CSS and JS to reduce CPU load, your question has already been answered on Server Fault: https://serverfault.com/questions/131452/apache2-mod-deflate-static-content