您好,登录后才能下订单哦!
1.网页压缩
2.网页缓存
1.配置防盗链
2.隐藏版本信息
配置网页压缩功能
工作模式的选择与参数优化
配置防盗链
配置隐藏版本号
1.降低了网络传输的字节数,加快网页加载的速度
2.节省流量,改善用户的浏览体验
3.gzip与搜索弓|擎的抓取工具有着更好的关系
1.mod_gzip模块
2.mod_deflate 模块
1.没有内建网页压缩技术,但可使用第三方mod_
1.在开发的时候,内建了mod_deflate 这个模块,取代mod_gzip
1.两者均使用gzip压缩算法,运作原理类似
2.mod_deflate 压缩速度略快,而mod_gzip 的压缩比略高
3.mod_gzip 对服务器CPU的占用要高一些
4.高流量的服务器,使用mod_deflate 可能会比mod_gzip 加载速度更快
1.执行apachectl -t -D DUMP MODULES命令
2.如果输出中没有deflate module (static),说明编译时没有安装
mod_ deflate模块
1../configure --enable-deflate...
2.make && make install
1.AddOutputFilterByType DEFL ATE text/html text/plain text/css
text/xml textjavascript
2.DeflateCompressionL evel
3.SetOutputFilter DEFL .ATE
[root@localhost ~]# mkdir /aaa
[root@localhost ~]# mount.cifs //192.168.10.12/rpm /aaa
Password for root@//192.168.10.12/rpm:
[root@localhost ~]# cd /aaa
[root@localhost aaa]# ls
LAMP
[root@localhost aaa]# cd LAMP/
[root@localhost LAMP]# ls
apr-1.6.2.tar.gz error.png
apr-util-1.6.0.tar.gz ha.jpg
awstats-7.6.tar.gz httpd-2.4.29.tar.bz2
cronolog-1.6.2-14.el7.x86_64.rpm mysql-5.6.26.tar.gz
Discuz_X2.5_SC_UTF8.zip php-5.6.11.tar.bz2
[root@localhost LAMP]# tar jxvf httpd-2.4.29.tar.bz2 -C /opt
[root@localhost LAMP]# tar zxvf apr-1.6.2.tar.gz -C /opt/
[root@localhost LAMP]# tar zxvf apr-util-1.6.0.tar.gz -C /opt
[root@localhost LAMP]# cd /opt/
[root@localhost opt]# ls
apr-1.6.2 apr-util-1.6.0 httpd-2.4.29 rh
[root@localhost opt]# mv apr-1.6.2/ httpd-2.4.29/srclib/apr
[root@localhost opt]# mv apr-util-1.6.0/ httpd-2.4.29/srclib/apr-util
[root@localhost opt]# yum install gcc gcc-c++ pcre pcre-devel zlib-devel expat-devel -y
[root@localhost opt]# cd httpd-2.4.29/
[root@localhost httpd-2.4.29]# ls
ABOUT_APACHE CMakeLists.txt INSTALL NWGNUmakefile
acinclude.m4 config.layout InstallBin.dsp os
Apache-apr2.dsw configure LAYOUT README
Apache.dsw configure.in libhttpd.dep README.cmake
apache_probes.d docs libhttpd.dsp README.platforms
ap.d emacs-style libhttpd.mak ROADMAP
build httpd.dep LICENSE server
BuildAll.dsp httpd.dsp Makefile.in srclib
BuildBin.dsp httpd.mak Makefile.win support
buildconf httpd.spec modules test
CHANGES include NOTICE VERSIONING
[root@localhost httpd-2.4.29]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
[root@localhost httpd-2.4.29]# make
[root@localhost httpd-2.4.29]# make install
[root@localhost httpd-2.4.29]# cd /usr/local/httpd/
[root@localhost httpd]# ls
bin cgi-bin error icons lib man modules
build conf htdocs include logs manual
[root@localhost httpd]# cd conf
[root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]# vim httpd.conf
[root@localhost conf]# ln -s /usr/local/httpd/conf/httpd.conf /etc/httpd.conf
[root@localhost conf]# vim /etc/httpd.conf
/deflate,搜索这个关键词
LoadModule deflate_module modules/mod_deflate.so //此行去除注释
/headers,搜索这个关键词
LoadModule headers_module modules/mod_headers.so //此行需要去除注释
/filter,搜索这个关键词
LoadModule filter_module modules/mod_filter.so //此行需要去除注释
/Listen,搜索这个关键词
Listen 192.168.18.128:80
#Listen 80
/ServerName,搜索这个关键词
ServerName www.kgc.com:80
按大写字母G到末行,按o转下行插入
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript text/ipg text/png
DeflateCompressionLevel 9
SetOutputFilter DEFLATE
</IfModule>
//修改结束后按Esc退出,输入:wq保存退出
[root@localhost conf]# /usr/local/httpd/bin/apachectl -t
Syntax OK
//验证语法是否正确
[root@localhost conf]# /usr/local/httpd/bin/apachectl start
[root@localhost conf]# netstat -ntap | grep 80
tcp 0 0 192.168.18.128:80 0.0.0.0:* LISTEN 82881/httpd [root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]# cd ..
[root@localhost httpd]# ls
bin cgi-bin error icons lib man modules
build conf htdocs include logs manual
[root@localhost httpd]# cd htdocs/
[root@localhost htdocs]# ls
index.html
[root@localhost htdocs]# cat index.html
<html><body><h2>It works!</h2></body></html>
[root@localhost htdocs]# cd /usr/local/httpd/bin/
[root@localhost bin]# ./apachectl -t -D DUMP_MODULES | grep "deflate"
deflate_module (shared)
[root@localhost bin]# cd /aaa/LAMP
[root@localhost LAMP]# ls
apr-1.6.2.tar.gz ha.jpg
apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2
awstats-7.6.tar.gz lf.jpg
cronolog-1.6.2-14.el7.x86_64.rpm mysql-5.6.26.tar.gz
Discuz_X2.5_SC_UTF8.zip php-5.6.11.tar.bz2
error.png
[root@localhost LAMP]# cp lf.jpg /usr/local/httpd/htdocs/ //把图片复制到对应的文件夹
[root@localhost LAMP]# cd /usr/local/httpd/
[root@localhost httpd]# cd htdocs/
[root@localhost htdocs]# ls
index.html lf.jpg
[root@localhost htdocs]# vim index.html
<html><body><h2>It works!</h2>
<img src="lf.jpg"/>
</body></html>
//格式做以上更改,在当中插入图片,按Esc退出,输入:wq保存退出
输入对方的IP地址之后可以看到添加的图片,我们通过抓包软件可以看到有图片的抓取信息中有在端口处进行gzip压缩处理信息
具体过程如下图所示:
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。