Enable Apache compression module to conserve website bandwidth

Source: Internet
Author: User

Background:

Web site with the increase in user access and content, the bandwidth of the site will continue to increase, with this is the increase in the cost of the site. And when the amount of content increases, the client if the bandwidth is small, it will affect the user's experience. Therefore, from these two aspects, the content of the site must be compressed and then passed on to the user, and then decompression in the user client, to achieve the effect of mutual benefit


1. Check if the Mod_deflate module is installed

/usr/local/apache2.2-xuegod/bin/apachectl-m | grep deflate


2. Configure compression parameters

/usr/local/apache2.2-xuegod/conf/httpd.conf #在以下内容后, insertion


<ifmodule mod_deflate.c>                deflatecompressionlevel 6    # Compression level, from 1 to 9, 9 is the highest level, the greater the efficiency, the higher the CPU consumption; It is understood that this can be reduced by up to 80% of the size of the transmission (depends on the contents of the file), at least half can be saved; Presets can use the value of  6 , In order to maintain the balance of processor efficiency and Web page compression quality, the general compression level uses 6 or 8   setoutputfilter deflate          #启用压缩    DeflateFilterNote Input instream   #声明输入流的byte数量    DeflateFilterNote Output outstream     #声明输出流的byte数量     DeflateFilterNote Ratio ratio      #声明压缩的百分比   Addoutputfilterbytype deflate text/html text/plain text/xml text/css application /javascript    #仅压缩, restricting specific MIME-type files </ifmodule> 


3. Test whether compression is enabled during data transfer

Website Detection: http://gzip.zzbaike.com/

or with YSlow plugin for Firefox, Google Explorer, to view the compression effect

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/90/B0/wKioL1jxzBeADIUqAABw8vEm-40419.png "title=" 1.png "alt=" Wkiol1jxzbeadiuqaabw8vem-40419.png "/>




This article is from "A horse on the Plains" blog, please be sure to keep this source http://huangzp.blog.51cto.com/12434999/1916271

Enable Apache compression module to conserve website bandwidth

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.