Get the App
SLTechnology News&Howtos  ›  Servers  › 

IIS enable GZIP compression js, css invalid how to solve

Shulou Source: shulou.com Published: 2022-05-31 10:56:00 09月21日 Update

This article mainly introduces IIS enable GZIP compression js, css invalid how to solve the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that after reading this IIS enable GZIP compression js, css invalid how to solve the article will have a harvest, let's take a look at it.

Test results in the website speed diagnosis of Kaka Network:

Gzip compression has been successfully enabled for html web pages

Gzip compression was not successfully enabled for css files

Later research found that when iis enables gzip, only html web pages are compressed by default, and if you need to compress css, js and other files, you also need to simply configure a file.

Open the file c:\ windows\ system32\ inetsrv\ metabase.xml, and then look for "iiscompressionscheme". You will find that there are three paragraphs, and don't worry about the latter one, just set the first two. Where "/ lm/w3svc/filters/compression/gzip" is used to set gzip compression and "/ lm/w3svc/filters/compression/deflate" is used to set deflate compression.

If you want to compress static files, set hcdostaticcompression and hcdoondemandcompression to "true", and add static files to be compressed in the properties of hcfileextensions: css, js, etc.

To compress dynamic files, set hcdodynamiccompression to "true" and add dynamic files that need to be compressed: aspx, php, and so on, in the hcscriptfileextensions property.

In addition, the hcdynamiccompressionlevel property and hcondemandcomplevel property are generally recommended to be set to 9, which has the best price / performance ratio.

Refer to the following parameter settings:

After setting up, restart iis, and then find that css, js and other files have successfully enabled gzip.

This is the end of the article on "how to solve the problem of IIS enabling GZIP compression js and invalid css". Thank you for reading! I believe that everyone has a certain understanding of "IIS enables GZIP compression js, css invalid how to solve" knowledge, if you want to learn more knowledge, welcome to follow the industry information channel.

Tags: Files attributes success knowledge content dynamic articles web pages static Chinese plus detection no two values parameters only cost-effective easy to operate articles easy to understand Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info NVidia Xiaomi vpn