Apache Web optimization----compression, caching

Source: Internet
Author: User

Lab Environment:

Required Packages: apr-util-1.4.1.tar.gz, httpd-2.4.2.tar.gz, apr-1.4.6.tar.gz

The host shared folder has been hung under/ABC

Experimental steps:

First, manually compile and install Apache

--------------------Install the package---------------------

Cd/abc
Yum Remove httpd–y????? Uninstalling the default installed HTTPD service
Tar zxvf apr-1.4.6.tar.gz-c/opt
Tar zxvf apr-util-1.4.1.tar.gz-c/opt
Tar zxvf httpd-2.4.2.tar.gz-c/opt

Cd/opt
Cp-r APR-1.4.6/HTTPD-2.4.2/SRCLIB/APR
Cp-r Apr-util-1.4.1/httpd-2.4.2/srclib/apr-util

------------------------Install the compilation environment---------------------
Yum install gcc gcc-c++ pcre pcre-devel zlib-devel–y

--------------------manually configure the installation-------------------

Cd/opt/httpd-2.4.2/
./configure \
--PREFIX=/USR/LOCAL/HTTPD \?????????????????? Specify the profile path
--enable-deflate \???????????????????????????????? Turn on the compression function
--enable-expires \??????????????????????????????? Turn on the cache function
--ENABLE-SO \???????????????????????????????????????? Enable dynamic module loading
--enable-rewrite \??????????????????????????????? Enable override feature
--enable-charset-lite \??????????????????????? Enable Character Set support
--enable-cgi????????????????????????????????????????? Enable CGI scripting support


Make && make install

------------------------------Set the startup script---------------
Grep-v "#"/usr/local/httpd/bin/apachectl >/ETC/INIT.D/HTTPD? Startup scripts

Vim/etc/init.d/httpd

? #!/bin/sh
????? # chkconfig:2345 85 15
????? # Description:apache is a world Wide Web server.

chmod +x/etc/init.d/httpd
Chkconfig--add httpd
Chkconfig--list httpd
Chkconfig--level httpd on

----------------------------establish a soft connection for easy management--------------------
Ln-s/usr/local/httpd/conf/httpd.conf/etc/httpd.conf?? Establish a soft connection for easy management
Vim/etc/httpd.conf

? Listen 192.168.100.20:80
?? #Listen 80

? ServerName www.benet.com:80


Setenforce 0
Service Iptables Stop
Cd/usr/local/httpd/bin
./apachectl-t?? Check syntax for problems

?????? ? Syntax OK??? Show no exception
Service httpd Start
Netstat-ntap | grep 80

Second, turn on the transmission compression function
Vim/etc/httpd.conf
LoadModule deflate_module modules/mod_deflate.so? Turn on the compression function
LoadModule headers_module modules/mod_headers.so? Turn on the head
LoadModule filter_module modules/mod_filter.so? Turn on the filter
<ifmodule mod_deflate.c>
??? Addoutputfilterbytype DEFLATE text/html text/plain text/css text/xml text/javascript?? File types that support compression
??? Deflatecompressionlevel 9??? Compression ratio
??? Setoutputfilter DEFLATE??? Supported Compression module modes
??? </IfModule>
./apachectl-t
Service httpd Restart
./apachectl-t-D dump_modules | grep "Deflate"?? Check that the module is turned on

Third, open the cache to more

Vim/etc/httpd.conf

? LoadModule Expires_module modules/mod_expires.so??? Turn on the cache module

<ifmodule mod_expires.c>
?? Expiresactive on
?? ExpiresDefault "Access plus seconds"???????????? Cache time 50s
? </IfModule>

Experimental content:

First, manually compile and install Apache

The contents are detailed in the experimental steps &http://blog.51cto.com/13710287/2135619

Second, turn on the transmission compression function

Third, open the cache to more

Apache Web optimization----compression, caching

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.