Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Mod_deflate module based on httpd

Shulou Source: shulou.com Published: 2022-06-01 07:04:54 10月03日 Update

1. Role

Save bandwidth, extra CPU consumption; some older browsers do not support;

compressing resources suitable for compression, such as text files;

2. Related modules

LoadModule deflate_module modules/mod_deflate.so (CentOS6 default enabled)

3. Configuration (httpd-2.2)

~]# vim /etc/httpd/conf.d/mod_deflate.conf

enter the following code

SetOutputFilter DEFLATE#Set compression filter, Indicates which types are suitable for compression # mod_deflate configuration# Restrict compression to these MIME typesAddOutputFilterByType DEFLATE text/plainAddOutputFilterByType DEFLATE text/htmlAddOutputFilterByType DEFLATE application/xmlAddOutputFilterByType DEFLATE text/xmlAddOutputFilterByType DEFLATE application/x-javascriptAddOutputFilterByType DEFLATE text/javascriptAddOutputFilterByType DEFLATE text/css# Level of compression (Highest 9 - Lowest 1)DeflateCompressionLevel 6 #Compression level depends on CPU consumption and bandwidth, 6 is default # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html# Netscape 4.06-4.08 have some more problemsBrowserMatch ^Mozilla/4\.0[678] no-gzip# MSIE masquerades as Netscape, but it is fineBrowserMatch \bMSIE ! no-gzip ! gzip-only-text/html

~]# httpd -t~]# service httpd reload

4. Confirm the compression effect

configure the front

post-configured

Tags: Configuration bandwidth consumption modules code roles effects files text browsers types levels resources filters parts support browsing input Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Tech Info Microsoft Linux Shulou Information