Configure mod_deflat compression output for Apache [original]

Source: Internet
Author: User

[Author: Zhang banquet this article version: V1.0 last modified: 2007.09.10 reprint please indicate the source: http://blog.s135.com]

1. If Apache is not installed. During compilation, add -- enable-Deflate. For example: (for Linux only, this step is not required for Windows)
./Configure -- prefix =/usr/local/Apache -- enable-Rewrite -- enable-so -- enable-Deflate

2. If Apache is installed. Add the mod_deflate module. For example: (for Linux only, this step is not required for Windows)
/Usr/local/Apache/bin/apxs-I-a-c/home/zhangyan/software/httpd-2.0.59/modules/filters/mod_deflate.c
Note:/home/zhangyan/software/httpd-2.0.59/is the Apache source code path.

3. After performing the preceding steps, a line is automatically added to httpd. conf: (remove the # At the beginning of the downlink for Windows)

Reference loadmodule deflate_module modules/mod_deflate.so

4. Edit httpd. conf and add:
Linux:

Reference <ifmodule mod_deflate.c>
Deflatecompressionlevel 9
Setoutputfilter deflate
# Deflatefilternote input instream
# Deflatefilternote output outstream
# Deflatefilternote ratio Ratio
# Logformat' "% R" % N/% N (% N %) 'deflate
# Customlog logs/deflate_log.log deflate
</Ifmodule>

Windows:

Reference <ifmodule deflate_module>
Deflatecompressionlevel 9
Setoutputfilter deflate
# Deflatefilternote input instream
# Deflatefilternote output outstream
# Deflatefilternote ratio Ratio
# Logformat' "% R" % N/% N (% N %) 'deflate
# Customlog logs/deflate_log.log deflate
</Ifmodule>

If you remove the # sign, you can view the number of bytes before and after the file is compressed in the logs/deflate_log.log file. For example:
"Get/index. html HTTP/1.1" 49373/276249 (17%)
The number of bytes before compression is 276249, the number of bytes after compression is 49373, and the compression ratio is 17%.

5. For detailed configuration, see apache Official Website: http://httpd.apache.org/docs/2.0/mod/mod_deflate.HTML

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.