您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。