Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Enabling Gzip Compression on IIS to Enhance Web Page Loading Speed

Tech 1

Benefits of Gzip Compression

Enabling Gzip compression significantly improves page load times. While code minification and image compression are beneficial, Gzip compression typically yields more substantial gains. It can achieve compression rates of around 70%, meaning a 30KB file can be reduced to approximately 9KB.

Step 1: Configure HTTP Compression in IIS

Open Internet Information Services (IIS) Manager. Right-click on you're website and select 'Properties'. Navigate to the 'Service' tab. Within the 'HTTP Compression' section, check the boxes for 'Compress application files' and 'Compress static files'. Configure the 'Temporary directory' and its size limit as needed.

Step 2: Enable the Web Service

Ensure the World Wide Web Publishing Service is runing.

Step 3: Modify the MetaBase.xml Configuration File

Open the directory C:\Windows\System32\inetsrv\. Locate the MetaBase.xml file and create a backup before editing. (Some server configurations may not require this step).

Search for the line containing Location ="/LM/W3SVC/Filters/Compression/gzip".

Review the existing compression scheme configurations. Replace the relevant sections with the following configuration to enable compression for common web file types:

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

After modifying the file, stop the 'IIS Admin Service' from the Windows Services console. Save the MetaBase.xml file and then restart the IIS Admin Service and the World Wide Web Publishing Service.

To verify successful Gzip compression, use an online tool to analyze your webstie's HTTP headers for the Content-Encoding: gzip response header.

Tags: IIS

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.