iis6开启gzip之后,百度蜘蛛会返回200 0 64,例如
2011-11-18 12:52:03 W3SVC1 GET /note/notesendzy.asp touserid=38279 - 220.181.108.151 Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html) sbyw.cnzhixue.com 200 0 64 548 257 62
2011-11-18 12:51:58 W3SVC1 GET /info/exerciseinfozy.asp puserid=21196 - 220.181.108.168 Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html) www.cnzhixue.com 200 0 64 498 260 234
而长期200 0 64的话会导致网站被K,然而自己那台服务器流量基本上满了,必须要优化了。此时,C:\WINDOWS\system32\inetsrv\MetaBase.xml关于gzip的压缩是这样设置的:
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="0"
HcDoDynamicCompression="FALSE"
HcDoOnDemandCompression="FALSE"
HcDoStaticCompression="FALSE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
js
css
txt
xml"
HcOnDemandCompLevel="9"
HcPriority="1"
HcScriptFileExtensions="asp
html" --注:本站采用伪静态,因此把html写到动态压缩里了
>
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="1"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
js
css
xml
txt"
HcOnDemandCompLevel="9"
HcPriority="1"
HcScriptFileExtensions="asp
html" --注:本站采用伪静态,因此把html写到动态压缩里了
>
HcCacheControlHeader="max-age=86400"
HcCompressionBufferSize="8192"
HcCompressionDirectory="%windir%\IIS Temporary Compressed Files"
HcDoDiskSpaceLimiting="FALSE"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcExpiresHeader="Wed, 01 Jan 1997 12:00:00 GMT"
HcFilesDeletedPerDiskFree="256"
HcIoBufferSize="8192"
HcMaxDiskSpaceUsage="100000000"
HcMaxQueueLength="1000"
HcMinFileSizeForComp="1"
HcNoCompressionForHttp10="TRUE"
HcNoCompressionForProxies="TRUE"
HcNoCompressionForRange="FALSE"
HcSendCacheHeaders="FALSE"
>
对youku.com和sina.com分析过之后,参考 http://seo.chinaz.com/?host=www.youku.com,细心的人会发现Content-Encoding: deflate,即优酷是采用deflate压缩方式。
经过仔细研究之后,终于找到解决方法
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="0"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE" --把压缩方式换成了deflate方式
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
js
css
txt
xml"
HcOnDemandCompLevel="9"
HcPriority="1"
HcScriptFileExtensions="asp
html"
>
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="1"
HcDoDynamicCompression="FALSE"
HcDoOnDemandCompression="FALSE"
HcDoStaticCompression="FALSE" --把压缩方式换成了deflate方式
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
js
css
xml
txt"
HcOnDemandCompLevel="9"
HcPriority="1"
HcScriptFileExtensions="asp
html"
>
HcCacheControlHeader="max-age=86400"
HcCompressionBufferSize="8192"
HcCompressionDirectory="%windir%\IIS Temporary Compressed Files"
HcDoDiskSpaceLimiting="FALSE"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcExpiresHeader="Wed, 01 Jan 1997 12:00:00 GMT"
HcFilesDeletedPerDiskFree="256"
HcIoBufferSize="8192"
HcMaxDiskSpaceUsage="100000000"
HcMaxQueueLength="1000"
HcMinFileSizeForComp="1"
HcNoCompressionForHttp10="FALSE" --这里将默认的TRUE改为FALSE
HcNoCompressionForProxies="TRUE"
HcNoCompressionForRange="FALSE"
HcSendCacheHeaders="FALSE"
>
iisreset之后,日志里一切正常了。
2011-11-18 13:00:17 W3SVC1 HEAD /material/materialzy.asp materialid=164860 - 220.181.51.94 Baiduspider+(+http://www.baidu.com/search/spider.htm) czjy.cnzhixue.com 200 0 0 481 205 375
2011-11-18 13:00:17 W3SVC1 GET /material/materialzy.asp materialid=164860 - 220.181.51.90 Baiduspider+(+http://www.baidu.com/search/spider.htm) czjy.cnzhixue.com 200 0 0 35418 204 359
评论回复