The server of Apache (iii)--Web and security optimization

Source: Internet
Author: User

In an enterprise, there are a number of issues when deploying Apache with only the default configuration parameters, because those configurations are configured for the previous server.

One, web compression

1. Introduction

Configure Apache Web page compression function, is to use the GZIP compression algorithm to the Apache server published Web content compressed and then transferred to the client browser, so that the network to reduce the number of bytes transferred, speed up the loading of web pages, save traffic, improve the user experience, And using gzip has a better relationship with search engine crawlers.

The module that can realize the compression function has Mod_gzip module and Mod_deflate module.

The apache1.x series does not have built-in Web page compression technology, but can use additional third-party mod_gzip modules to perform compression

apache2.x official development of the time, the page compression into account, built a mod_deflate This module, can replace Mod_gzip

The difference between the two:

Mod_gzip to the CPU of the server higher, high compression ratio

Mod_deflate compression speed slightly faster

High-traffic servers, using mod_deflate may load faster than Mod_gzip

2. Operation method

  Apachectl-t-D Dump_modules | grep "Mod_deflate" (if this module is not filtered out, it needs to be installed)

cd/usr/src/httpd-2.2.17

Service httpd Stop

./configue--enable-deflate

Make && make install

Vim/usr/local/httpd/conf/httpd.conf

Adding rows

Addoutputfilterbytype DEFLATE text/html text/plain text/css text/xml text/javascript (indicates what kind of content is enabled for compression)

Deflatecompressionlevel 9 (compression level)

Setoutputfilter DEFLATE (on behalf of the Enable DEFLATE module for gzip compression of the output of this site)

Service httpd Start

For ease of comparison, you can use the Grab kit tool analysis, such as the Fiddler tool under Windows, before enabling the Mod_deflate module.

The capture tool before compression shows:

    

After compression:

    

The server of Apache (iii)--Web and security optimization

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.