1. Opening of the compression function
Yum Remove httpd//Uninstall the original Apache file
Cd/opt/lamp
Tar xzvf httpd-2.4.2.tar.gz-c/opt//manual Compilation installation httpd
Tar xzvf apr-1.4.6.tar.gz-c/opt//Support Apache Upper application cross-platform, provide the bottom interface library
Tar xzvf apr-util-1.4.1.tar.gz-c/opt
Cd/opt
Cp-r apr-1.4.6//OPT/HTTPD-2.4.2/SRCLIB/APR
Cp-r APR-UTIL-1.4.1//opt/httpd-2.4.2/srclib/apr-util
Yum install-y gcc gcc-c++ pcre pcre-devel zlib-devel//Install Environment package (pcre: A Perl library that supports regular expressions)
cd/opt/httpd-2.4.2
./configure \
--PREFIX=/USR/LOCAL/HTTPD \
--enable-deflate \
--ENABLE-SO \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi
Make && make install
Grep-v "#"/usr/local/httpd/bin/apachectl >/ETC/INIT.D/HTTPD//Startup script
VIM/ETC/INIT.D/HTTPD Insert the following line at the front of the file
#!/bin/sh
chkconfig:2345 15description:apache is a world Wide Web server.
chmod +x/etc/init.d/httpd
chkconfig--add httpd
chkconfig--list httpd
chkconfig--level/httpd on//script execution Permissions and start-up
Ln-s/usr/local/httpd/conf/httpd.conf/etc/httpd.conf//Soft connection easy to manage
vim/etc/httpd.conf
CD /usr/local/httpd/bin
./APACHECTL-T//Check syntax for httpd.conf
vim/etc/httpd.conf
LoadModule deflate_module modules/mod_deflate.so//Turn on the compression function module
Insert the following information at the end of the file
<ifmodule mod_deflate.c>
Addoutputfilterbytype DEFLATE text/html text/plain text/css text/xml text/javascript//compressible file types
Deflatecompressionlevel 9//Compression ratio
Setoutputfilter DEFLATE//type of support compression module (DEFLATE)
</IfModule>
./apachectl-t-D dump_modules | grep "deflate"//check whether the compression function module is turned on
2. Cache Settings
./configure \
--PREFIX=/USR/LOCAL/HTTPD \
--enable-deflate \
--enable-expires \
--ENABLE-SO \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi
Make && make install
Grep-v "#"/usr/local/httpd/bin/apachectl >/ETC/INIT.D/HTTPD
VIM/ETC/INIT.D/HTTPD Insert the following line at the front of the file
#!/bin/sh
chkconfig:2345 15description:apache is a world Wide Web server.
chmod +x/etc/init.d/httpd
Chkconfig--add httpd
Chkconfig--list httpd
Chkconfig--level httpd on//execute permissions for scripts and boot from
Ln-s/usr/local/httpd/conf/httpd.conf/etc/httpd.conf
Vim/etc/httpd.conf
LoadModule expires_module modules/mod_expires.so//Open Cache function module
Insert the following information at the end of the file
</IfModule>
<ifmodule mod_deflate.c>
Expiresactive on
ExpiresDefault "Access plus seconds"
</IfModule>
Cd/usr/local/httpd/bin
./apachectl–t//Check syntax is correct
Apache module compression and cache settings