在前篇提過使用 mod_gzip 增進傳輸效能,但似乎有些地方有問題,如果加上mod_gzip_item_include mime application/x-httpd-php
,照理說應該會把 php 的輸出壓縮傳出,但是在 browser 看到的是空白一片. 只好試試 Apache2 官方包裝內的 mod_deflate,結果沒有出現同樣的問題,官方版還是比較有保障.
用法如下:
在 httpd.conf 加上
LoadModule deflate_module modules/mod_deflate.so
DeflateCompressionLevel 9
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js
其中 DeflateCompressionLevel 9 是最高壓縮,經實驗證明,壓縮能力跟 mod_gzip 是一樣的,style.css 12911 bytes,壓縮傳送同樣是 3342 bytes.
Apache2 還是推薦使用 mod_deflate 較好.
(Visited 11,572 times, 1 visits today)
Pingback: 網站製作學習誌
Pingback: Bojack’s Blog » Blog Archives » Apache 加速瀏覽調校篇
Pingback: [ THE VOiCE ] » WordPress 初心者設定
Pingback: 雞捲的記事本 » Blog Archive » Apache2 使用 mod_deflate 增進傳輸效能
Pingback: 網站製作學習誌 » Apache 伺服器非官方已編譯模組
Pingback: WordPress 初心者設定 | [ THE VOiCE ]
Pingback: 如何幫Wordpress加入gzip壓縮,並做一些網路優化 | 到處閒晃