gzip 压缩的文件是否在服务器端缓存?

发布于 2024-09-27 16:41:50 字数 112 浏览 0 评论 0原文

当使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荭秂 2024-10-04 16:41:50

旧的 Apache 1.3 系列有选项:

mod_gzip_can_negotiate Yes
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
mod_gzip_update_static Yes

这样做,但 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:

mod_gzip_can_negotiate Yes
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
mod_gzip_update_static Yes

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文