我尝试在shell下用curl -I www.example.com 无果
在php5中使用get_headers(); 无果
使用live http headers 这个firefox的扩展倒是可以做到。不过记得要配置好(过滤url),不然复杂的网页会有很多无用的信息。
参看http返回的头里面有没有 Content-Encoding: gzip
httpwatch 这个ie的扩展看不到Content-Encoding这样的头(专业版可以,但是需要钱)。 但是可以通过其他信息推出有没有gzip。performance 里的 HTTP Compression Savings 0 bytes
nginx
默认编译是带有gzip模块的,只需要设置
gzip on;
文档http://wiki.codemongers.com/NginxHttpGzipModule
apache使用 mod_deflate 提供gzip功能
这是一个针对心急者的示范配置:
仅仅压缩少数几种类:
AddOutputFilterByType DEFLATE text/html text/plain text/xml
http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_deflate.html
php中 例 1. ob_gzhandler() example
<?php
|