如何判断我的服务器是否正在提供 GZipped 内容? [英] How can I tell if my server is serving GZipped content?

查看:21
本文介绍了如何判断我的服务器是否正在提供 GZipped 内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 NGinx 服务器上有一个 web 应用程序.我在 conf 文件中设置了 gzip on,现在我想看看它是否有效.YSlow 说它不是,但是进行测试的 6 个网站中有 5 个说它是.我如何才能得到明确的答案,为什么结果会有所不同?

I have a webapp on a NGinx server. I set gzip on in the conf file and now I'm trying to see if it works. YSlow says it's not, but 5 out of 6 websites that do the test say it is. How can I get a definite answer on this and why is there a difference in the results?

推荐答案

看起来一个可能的答案是,不出所料,curl:

It looks like one possible answer is, unsurprisingly, curl:

$ curl http://example.com/ --silent --write-out "%{size_download}
" --output /dev/null
31032
$ curl http://example.com/ --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}
" --output /dev/null
2553

在第二种情况下,客户端告诉服务器它支持内容编码,您可以看到响应确实更短、压缩了.

In the second case the client tells the server that it supports content encoding and you can see that the response was indeed shorter, compressed.

这篇关于如何判断我的服务器是否正在提供 GZipped 内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆