隨筆-179  評論-666  文章-29  trackbacks-0

          在頁面中使用gzip可以有效的減低頁面的大小,加快網頁的下載速度。在lighttpd中對php頁面進行壓縮,需要兩個步驟:

          1. 編輯 lighttpd.conf

          將 “mod_compress” 設為啟用

          接著找到

          ## compress module

          在下面加入

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

          做完上面的動作后,
          基本上 .txt .html .css .js 的文件都會被Gzip壓縮了。但php此時還沒有壓縮

          對于動態的php文件,還需要在php.ini中做相關設置,否則.php頁面還是不使用壓縮模式
          2. 編輯 php.ini
          修改
          zlib.output_compression = On
          zlib.output_handler = On

          重新啟動Lighttpd。
          這樣php也壓縮了

          posted on 2011-06-22 23:25 Alpha 閱讀(814) 評論(0)  編輯  收藏 所屬分類: Linux Nginx
          主站蜘蛛池模板: 上杭县| 许昌县| 渝中区| 彩票| 巴南区| 临江市| 邛崃市| 马边| 南昌县| 岫岩| 花莲县| 鄂尔多斯市| 巴彦淖尔市| 夏河县| 新干县| 福建省| 唐河县| 大余县| 漳平市| 桐庐县| 石景山区| 镇原县| 称多县| 万源市| 修水县| 本溪| 沈丘县| 望江县| 鹤庆县| 徐汇区| 都匀市| 五原县| 平南县| 通化市| 廉江市| 会泽县| 锡林郭勒盟| 盐亭县| 西畴县| 东丽区| 秀山|