日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
如何進(jìn)行Apache服務(wù)mod_deflate模塊分析

如何進(jìn)行Apache服務(wù)mod_deflate模塊分析,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

成都創(chuàng)新互聯(lián)成立十多年來,這條路我們正越走越好,積累了技術(shù)與客戶資源,形成了良好的口碑。為客戶提供成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、網(wǎng)站策劃、網(wǎng)頁設(shè)計(jì)、域名注冊(cè)、網(wǎng)絡(luò)營銷、VI設(shè)計(jì)、網(wǎng)站改版、漏洞修補(bǔ)等服務(wù)。網(wǎng)站是否美觀、功能強(qiáng)大、用戶體驗(yàn)好、性價(jià)比高、打開快等等,這些對(duì)于網(wǎng)站建設(shè)都非常重要,成都創(chuàng)新互聯(lián)通過對(duì)建站技術(shù)性的掌握、對(duì)創(chuàng)意設(shè)計(jì)的研究為客戶提供一站式互聯(lián)網(wǎng)解決方案,攜手廣大客戶,共同發(fā)展進(jìn)步。

LAMP架構(gòu)應(yīng)用實(shí)戰(zhàn)—Apache服務(wù)

mod_deflate壓縮模塊

今天來介紹下比較常用的模塊mod_deflate壓縮模塊

一:mod_deflate模塊介紹

mod_deflate壓縮模塊提供了DEFLATE輸出過濾器,允許服務(wù)器將內(nèi)容發(fā)送給客戶端之前進(jìn)行壓縮,節(jié)省帶寬資源

二:mod_deflate模塊查看

直接編譯安裝查看如下

[root@Centos modules]# /application/apache/bin/apachectl -l|grep mod_deflate

mod_deflate.c

以DSO方式編譯安裝查看如下

[root@Centos modules]# ls -l|grep defla

-rwxr-xr-x. 1 root root  86591 Sep 18 15:26 mod_deflate.so

但是以上兩種方式不能同時(shí)安裝,否則會(huì)出現(xiàn)錯(cuò)誤

[root@Centos conf]# /application/apache/bin/apachectl -M|grep deflate

 deflate_module (shared)

查看幫助

[root@Centos httpd-2.4.23]# ./configure --help|grep deflate    

  --enable-deflate        Deflate transfer encoding support

編譯、或以DSO安裝方式安裝與前面的緩存模塊安裝相同,這里就不再介紹了

三:mod_deflate配置

配置前看下HTTP頭的信息

[root@Centos modules]# curl -I http://blog.abc.com:9999/

HTTP/1.1 200 OK

Date: Sun, 18 Sep 2016 07:37:58 GMT

Server: Apache/2.4.23 (Unix)

Last-Modified: Fri, 09 Sep 2016 12:19:55 GMT

ETag: "1f-53c122a061992"

Accept-Ranges: bytes

Content-Length: 31

Cache-Control: max-age=31104000

Expires: Wed, 13 Sep 2017 07:37:58 GMT

Content-Type: text/html

備份并配置模塊

[root@Centos conf]# cp httpd.conf httpd.conf.0918

[root@Centos conf]# vi httpd.conf 

中間內(nèi)容省略

DeflateCompressionLevel 9

SetOutputFilter DEFLATE

AddOutputFilterByType DEFLATE text/html text/plain /text/xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE text/css

"httpd.conf" 521L, 18903C written

語法檢查與服務(wù)重啟

[root@Centos conf]# /application/apache/bin/apachectl -t

Syntax OK

[root@Centos conf]# /application/apache/bin/apachectl graceful

[root@Centos conf]# lsof -i tcp:9999

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

httpd    2156   root    8u  IPv6  16255      0t0  TCP *:distinct (LISTEN)

httpd   13911 daemon    8u  IPv6  16255      0t0  TCP *:distinct (LISTEN)

httpd   13912 daemon    8u  IPv6  16255      0t0  TCP *:distinct (LISTEN)

httpd   13913 daemon    8u  IPv6  16255      0t0  TCP *:distinct (LISTEN)

[root@Centos conf]# ps -ef|grep http

root 2156 10 15:13 ? 00:00:00 /application/apache2.4.23/bin/httpd -k restart

daemon13911 2156  0 15:49  00:00:00 /application/apache2.4.23/bin/httpd -k restart

daemon 13912 2156  0 15:49   00:00:00 /application/apache2.4.23/bin/httpd -k restart

daemon 13913  2156  0 15:49 ?00:00:00 /application/apache2.4.23/bin/httpd -k restart

root  14003  1941 015:50 pts/0   00:00:00 grep http

測(cè)試配置內(nèi)容

[root@Centos conf]# curl -I http://blog.abc.com:9999/deflate.html

HTTP/1.1 200 OK

Date: Sun, 18 Sep 2016 09:32:39 GMT

Server: Apache/2.4.23 (Unix)

Last-Modified: Sun, 18 Sep 2016 08:10:40 GMT

ETag: "309-53cc3bb2de520"

Accept-Ranges: bytes

Content-Length: 777

Vary: Accept-Encoding      出現(xiàn)這個(gè)提示表明已啟用壓縮

Cache-Control: max-age=31104000

Expires: Wed, 13 Sep 2017 09:32:39 GMT

Content-Type: text/html

把之前的配置內(nèi)容注釋掉

[root@Centos conf]# /application/apache/bin/apachectl -t

Syntax OK

[root@Centos conf]# /application/apache/bin/apachectl graceful   

[root@Centos conf]# ps -ef |grep http

root 14492 1  0 17:03 ?  00:00:00 /application/apache2.4.23/bin/httpd -k restart

daemon  14998  14492  0 17:39 ?  00:00:00 /application/apache2.4.23/bin/httpd -k restart

daemon 14999  14492  0 17:39 ?  00:00:00 /application/apache2.4.23/bin/httpd -k restart

daemon 15000  14492  0 17:39 ?00:00:00 /application/apache2.4.23/bin/httpd -k restart

root  15083 148  0 17:39 pts/0  00:00:00 grep http

[root@Centos conf]# lsof -i tcp:9999

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

httpd   14492   root    8u  IPv6  28964      0t0  TCP *:distinct (LISTEN)

httpd   14998 daemon    8u  IPv6  28964      0t0  TCP *:distinct (LISTEN)

httpd   14999 daemon    8u  IPv6  28964      0t0  TCP *:distinct (LISTEN)

httpd   15000 daemon    8u  IPv6  28964      0t0  TCP *:distinct (LISTEN)

[root@Centos conf]# curl -I http://blog.abc.com:9999/deflate.html

HTTP/1.1 200 OK

Date: Sun, 18 Sep 2016 09:40:08 GMT

Server: Apache/2.4.23 (Unix)

Last-Modified: Sun, 18 Sep 2016 08:10:40 GMT

ETag: "309-53cc3bb2de520"

Accept-Ranges: bytes

Content-Length: 777

Cache-Control: max-age=31104000

Expires: Wed, 13 Sep 2017 09:40:08 GMT

Content-Type: text/html

發(fā)現(xiàn)沒有配置的時(shí)候是不會(huì)出現(xiàn)相關(guān)提示內(nèi)容

提示:如果編譯安裝后,主配置文件中沒有加入deflate此模塊,那么我們可以手要增加一個(gè)這樣的模塊

LoadModule deflate_module modules/mod_deflate.so

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)的支持。


當(dāng)前標(biāo)題:如何進(jìn)行Apache服務(wù)mod_deflate模塊分析
文章地址:http://www.dlmjj.cn/article/piieio.html