Enable javascript gzip compression in IIS?

We strive to compress our gargantuan JavaScript files using GZip to speed up the loading of pages on our site. I know that this can be done through IIS, but I cannot find a simple step-by-step guide on how to implement it.

If someone can point me to such a guide, I would really appreciate it. I have never done this before, so it should be pretty simple.

We are running IIS7.5 on Windows Server 2008 R2 .

Your time is greatly appreciated.

+4
source share
3 answers

It turns out this is very easy:

  • Go to IIS Manager
  • Go to the site in question
  • Go to the Compression section (under IIS) and double-click on it.
  • Make sure Enable Static Compression is enabled.

Just like that!

The only problems are with dynamically generated content, but I'm not interested in compressing this, so this is my answer. (I can't believe it was that simple ... other guides made him look like a nightmare!)

+8
source

"Enable static compression" did not work at first.

I found that when I had these lines in my web.config file of my site between <system.webserver> , it works:

 <staticContent> <remove fileExtension=".js" /> <mimeMap fileExtension=".js" mimeType="text/javascript" /> </staticContent> 

But I have to install it in each of my web.config file, and if I have a PHP site that works in IIS compression, it doesnโ€™t work, it also doesnโ€™t seem to work for my HMTL, since I get (in ySlow):

Class C on gzip compression components

There are two simple text components that should be sent compressed.

 * http://www.ville.st-augustin.qc.ca/ * http://jquery-ui.googlecode.com/svn/tags/1.8/ui/minified/jquery.effects.core.min.js 
+4
source

Be sure to make sure your JavaScript files are actually compressed when you simply enable static content compression. In our scenario, this was not so. This article gives a good overview of why Getting IIS 7 for JavaScript compression , and in the comments by @Doug Mayer recommends enabling dynamic content compression, which works for us.

So the steps are:

  • In IIS Manager
  • Select the desired level, server, web application, folder
  • Open Compression in IIS
  • Check the box next to "Enable dynamic content compression."
  • To apply

If this option is inactive, you must first add the Dynamic Content Compression server role service in the Web Server | Performance in the server manager.

+1
source

Source: https://habr.com/ru/post/1305031/


All Articles