Apache Tuning Open Deflate Compression module

Source: Internet
Author: User

enable the Apache deflate module to turn on compression and reduce bandwidth when the website is transmitted.


Apache needs to compile the installation mode, to/usr/local/apache for the Apache installation directory, the source package/usr/local/src/httpd-2.4.33 as an example




First View/usr/local/apache/bin/apachectl-m # # #查看里面的模块是否有deflate模块, you can also filter/usr/local/apache/bin/apachectl-m | grep deflate



If there is a httpd.conf under the open, if not shown, or with grep filtered after the display syntax OK, the module is not installed.



Compile and install the Deflate module in Dynamic shared module mode (DSO)


/usr/local/apache/bin/apxs-c-i-a/usr/local/src/httpd-2.4.33/modules/filters/mod_deflate.c #其中前面部分是安装好的apache软件里面的apxs程序, behind the deflate compression module in Apache's Source installation package



APXS Program Compilation options:

-C means to perform a compile module operation

-I means performing the install module operation

-a means to automatically add a loadmodule line to the httpd.conf file to activate the module


When the installation is complete, see if the module is installed and activated in vi/usr/local/apache/conf/httpd.conf

LoadModule Deflate_module modules/mod_deflate.so


<ifmodule mod_deflate.c>

Deflatecompressionlevel 9 # # #压缩等级 (1-9), the higher the level of efficiency, but also the high CPU consumption, according to the specific situation tuning, can also be set to 6来 balance CPU and compression quality

Setoutputfilter DEFLATE

Deflatefilternote Input instream

deflatefilternote Output OutStream

deflatefilternote Ratio Ratio

Addoutputfilterbytype DEFLATE text/html text/plain text/xml text/css

Application/javascript # #仅压缩限制特定的MIME类型文件

</ifmodule>







Apache Tuning Open Deflate Compression module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.