Apache Web page Optimization page compression

Source: Internet
Author: User
Tags png text

Apache Web page Compression technology

Experiment Introduction: This experiment builds http-2.4.2 on the Linux system of the virtual machine, and in the configuration process opens the Mod_deflate module, realizes the webpage compression function, finally through Fiddler grasping the package tool, verifies mod_deflate compression is effective.

1, first will build httpd services required to copy the package to the virtual machine Linux system.

! []

2. Unzip the package into the specified directory.


3, the apr-1.4.6 and apr-util-1.4.1 extracted folders, copied to/httpd-2.4.2/srclib and renamed to Apr, Apr-util


4. Install some dependency packages using the Yum repository.


5. Switch to the httpd-2.4.2 directory for configuration


6. Compile and install after configuration

7. After compiling and installing, it is easy to set up httpd in/etc/init.d/directory.

8. Insert the following code at the beginning of the startup script, which is a fixed format for the startup script and adds executable permissions to the script

#!/bin/sh    # chkconfig:2345 85 15    # description:Apache is a World Wide Web server.


9. Connect the master profile via a soft link to the/etc/httpd.conf

10. Review and confirm that some of the relevant modules in the Apache master configuration file have been opened

LoadModule headers_module modules/mod_headers.soLoadModule deflate_module modules/mod_deflate.soLoadModule filter_module modules/mod_filter.so




11. Append the configuration area file for the compression module at the end of the main configuration file.

<IfModule mod_deflate.c>  AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/png text/javascript  DeflateCompressionLevel 9  SetOutputFilter DEFLATE</IfModule>


12, modify the listening address and domain name, listening address can modify the local IP, the domain name can be arbitrarily changed, followed by DNS to configure the domain name

13, verify that the configuration file is correct script in the/usr/local/httpd/bin directory, switch to the directory execution./APACHECTL-T, the configuration format is displayed correctly syntax OK

14. Continue to verify that the compression module is turned on successfully.

./apachectl -t -D DUMP_MODULES | grep "deflate"

The presence of Deflate_module (shared) indicates a successful start.


15. Let's verify that the firewall is turned off and the security features are enhanced.

16. Add an image to your home file to verify that the compression module is in effect. Home Store Path is/usr/local/httpd/htdocs/index.html


17, finally through the Fiddler tool capture package for verification. You can see that the picture has been compressed by gzip and the experiment is successful.

Apache Web page Optimization page compression

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.