設定 Gzip 後,檔案會變的比較小。

可以加快傳輸的速度,可減少資料量。是一個增加網頁效能不錯的方式。


編輯 lighttpd.conf

"mod_compress" 設為啟用

接著找到

## compress module

在下方加入

compress.cache-dir         = "/var/tmp/lighttpd/cache/"
compress.filetype          = ("text/plain", "text/html", "text/css", "text/javascript" )

接著重新啟動 Lighttpd 就可以了。


做完上面的動作後,

基本上 .txt .html .css .js 的檔案都會被壓縮了。

但是動態的檔案似乎還是沒有壓縮。

所以就要到PHP去設定了。(感謝聿彣提供的資訊)

編輯 php.ini

設定

zlib.output_compression = On
zlib.output_handler = On

重新啟動Lighttpd

搞定

 

arrow
arrow
    全站熱搜

    Ching-Wei 發表在 痞客邦 留言(0) 人氣()