在 IIS 6 中预压缩静态文件
我正在我的网站上对 CSS 和 JS 文件实施 Gzip 压缩,只需要仔细检查一些内容。
文件是否根据每个请求进行压缩?或者是从临时文件夹收集并发送的(如果文件存在)?我只是想确保我的文件不会根据每个请求进行压缩。
另外,这是默认行为还是我需要一些额外的配置?
最后,在路径中使用哈希标签(以通知浏览器文件已更改)和静态文件压缩时,我是否需要担心或配置某些内容?或者它应该可以正常工作。
编辑:我只是使用静态压缩
非常感谢
I am implementing Gzip compression for CSS and JS files on my site and just need to double check something.
Is the file compressed on every request? or is it collected and sent from the Temporary folder (if the file exists)? I just want to be sure that my files are not compressed on every request.
Also, is this a default behaviour or do I need some extra configurtion?
And last, do I need to worry or configure something when using hash tags in the path (to inform the browser that the file has changed) and static file compression? or it should work with no problem.
Edit: I am just using static compression
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了充分利用 IIS 压缩,您需要在元数据库文件中添加一些额外的位。
找到 IIsCompressionScheme 并对元基本文件进行以下编辑
完成后,使用 YSlow 等 FF 插件测试站点中的页面或 Firebug,使用 Firebug,您可以检查“网络”选项卡中的每个元素,并检查是否将正确的压缩应用于右侧文件类型。
这里有一篇很棒的文章和示例 http ://www.codinghorror.com/blog/2004/08/http-compression-and-iis-6-0.html
In order to get the most out of IIS compression you will need to add a few extra bits into the metabase file.
find the IIsCompressionScheme and make the following edits to the meta base file
Once done test a page from your site using a FF plug in like YSlow or Firebug, with Firebug you can inspect each element in the Net tab and check if the right compression is being applied to the right file types.
There is a great article with examples here http://www.codinghorror.com/blog/2004/08/http-compression-and-iis-6-0.html
IIS 6 支持动态和静态压缩。
查看 相关文档和不错的博客条目 关于这个主题。
IIS 6 supports both dynamic and static compression.
Have look at the relevant documentation and a decent blog entry on the subject.
“然后,新压缩的文件将存储在压缩目录中,并且直接从压缩目录提供对该文件的后续请求。换句话说,文件的未压缩版本将返回给客户端,除非文件的压缩版本已经存在存在于压缩目录中。"*
"The newly compressed file is then stored in the compression directory, and subsequent requests for that file are serviced directly from the compression directory. In other words, an uncompressed version of the file is returned to the client unless a compressed version of the file already exists in the compression directory."*