Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> 電腦軟件教程 >> 服務器技術 >> 關於服務器 >> 啟用IIS6的GZIP,提高網站打開速度

啟用IIS6的GZIP,提高網站打開速度

日期:2017/2/8 10:28:27      編輯:關於服務器
       IIS6默認情況下沒有開啟GZIP功能,需要我們手動配置,但他又沒提供圖形化配置功能,所以呀,像我這樣的技術人才,都沒考慮過使用他,昨天突然看到這個想到,也許對我有用,但從網上找了找,都是一堆手工操作方法,非常麻煩呀,不過以前研究過IIS的配置文件:C:\WINDOWS\system32\inetsrv\MetaBase.xml,所以呀,我知道只要是IIS的功能就可以通過修改這個文件來完成,所以呢,就對這個文件下手吧,根據網上提供的修改的地方,在網上搜索了一圈,找到一個類似ClickOnce 的東西,呵呵,我找的就是這個,所有操作都一鍵到位,只要執行一段VBS或CMD就配置好了,呵呵。

        使用Gzip壓縮會增大服務器CPU的使用率但可以通過壓縮而減少服務器向客戶端發送的數據,若使用了Gzip壓縮IIS在向客戶端發送數據時會自動檢測,如果客戶端浏覽器支持IE6.0,firefox Gzip,則使用Gzip壓縮後再傳送數據,如果不支持,則使用常規方式發送。

        所以,總結下他的優缺點,優:壓縮傳輸,速度一般提高2倍。缺:CPU占用會有所提高,不過通過我的一點分析,GZIP只是在訪問一個頁時才會進行壓縮,下次如果網頁沒有變動是不會壓縮的,除非是使用壓縮動態文件,這得實時的去壓縮。

REM Setup IIsCompressionScheme for deflate cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcCompressionDll "%windir%\system32\inetsrv\gzip.dll" cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcCreateFlags 0 cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcDoDynamicCompression TRUE cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcDoOnDemandCompression TRUE cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcDoStaticCompression TRUE cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel 9 cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "txt" "js" "xml" "css" cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcOnDemandCompLevel 9 cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcPriority 1 cscript adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx" REM Setup IIsCompressionScheme for GZip cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcCompressionDll "%windir%\system32\inetsrv\gzip.dll" cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcCreateFlags 1 cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDoDynamicCompression TRUE cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDoOnDemandCompression TRUE cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDoStaticCompression TRUE cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel 9 cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "js" "xml" "css" cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcOnDemandCompLevel 9 cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcPriority 1 cscript adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx" REM Setup IIsCompressionSchemes parameters cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcCacheControlHeader max-age=86400 cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcCompressionBufferSize 102400 cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcCompressionDirectory "%windir%\IIS Temporary Compressed Files" cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoDiskSpaceLimiting FALSE cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcExpiresHeader "Wed, 01 Jan 1997 12:00:00 GMT" cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcFilesDeletedPerDiskFree 256 cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcIoBufferSize 102400 cscript adsutil.vbs set W3SVC/Filters/Compression/Parameters/HcMaxDiskSpaceUsage 0  

以上是方法,保存做一個批處理命令文件即可。格式如:adsutil.vbs

Copyright © Windows教程網 All Rights Reserved