亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

IIS啟用GZIP壓縮js、css無效的原因及解決方法

 更新時間:2013年11月17日 23:25:25   作者:  
IIS啟用GZIP壓縮之后,原以為可以壓縮所有文件了,包括html、CSS、JS、圖片這些文件,但是當(dāng)我檢查的時候,發(fā)現(xiàn)并不是這樣的,壓縮的只有html文件,而CSS、JS并沒有壓縮

在卡卡網(wǎng)的網(wǎng)站速度診斷里的檢測結(jié)果:

html網(wǎng)頁已經(jīng)成功啟用了GZip壓縮

css文件未成功啟用GZip壓縮

      后來研究發(fā)現(xiàn),IIS啟用GZip時默認壓縮的只有html網(wǎng)頁,如果需要壓縮css、js等文件,還需要另外簡單配置一個文件。

      打開C:\WINDOWS\system32\inetsrv\MetaBase.xml這個文件,然后查找“IIsCompressionScheme”,會發(fā)現(xiàn)有三段,后面那個不用管,只設(shè)置前面兩個即可。其中,"/LM/W3SVC/Filters/Compression/gzip"用于設(shè)置gzip壓縮,"/LM/W3SVC/Filters/Compression/deflate"用于設(shè)置deflate壓縮。

      如需壓縮靜態(tài)文件,則將HcDoStaticCompression和HcDoOnDemandCompression設(shè)置為“TRUE”,并在HcFileExtensions的屬性中加入需要壓縮的靜態(tài)文件:css、js等;

      如需壓縮動態(tài)文件,則將HcDoDynamicCompression設(shè)置為“TRUE”,并在HcScriptFileExtensions屬性中加入需要壓縮的動態(tài)文件:aspx、php等。

      另外,HcDynamicCompressionLevel屬性和HcOnDemandCompLevel屬性一般都推薦設(shè)置為9, 具有最佳性價比。

      參考如下各參數(shù)設(shè)置:

<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/deflate"
  HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
  HcCreateFlags="0"
  HcDoDynamicCompression="TRUE"
  HcDoOnDemandCompression="TRUE"
  HcDoStaticCompression="TRUE"
  HcDynamicCompressionLevel="9"
  HcFileExtensions="htm
                        html
                        txt
                        css
                        js
                        xml"
  HcOnDemandCompLevel="9"
  HcPriority="1"
  HcScriptFileExtensions="asp
                        aspx
                        dll
                        exe"
 >
</IIsCompressionScheme>
<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"
  HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
  HcCreateFlags="1"
  HcDoDynamicCompression="TRUE"
  HcDoOnDemandCompression="TRUE"
  HcDoStaticCompression="TRUE"
  HcDynamicCompressionLevel="9"
  HcFileExtensions="htm
                        html
                        txt
                        css
                        js
                        xml"
  HcOnDemandCompLevel="9"
  HcPriority="1"
  HcScriptFileExtensions="asp
                        aspx
                        dll
                        exe"
 >
</IIsCompressionScheme>

      設(shè)置完畢后,重新啟動IIS,再檢測時發(fā)現(xiàn)css、js等文件已經(jīng)成功啟用GZip了。

 您可能對如下文章也感興趣

IIS啟用GZip壓縮的詳細教程【圖解】

相關(guān)文章

最新評論