FreeBSD Patch file 初體驗..(lighttpd mod_deflate module for freebsd)

今天早上看到
這篇文章
覺得應該把..目前的公司的網站來 壓縮一下…
不過因為用的web server 是lighttpd
目前1.4.X沒有預設是沒有這個功能的
1.5 預設會有

所以只好自已上patch ….
我的作法是………..

#cd /usr/ports/www/lighttpd
#make
..............
..............

#cd work
#cp -rp lighttpd-1.4.19 lighttpd-1.4.19-org
#fetch http://trac.lighttpd.net/trac/raw-attachment/wiki/Mod_Deflate/lighttpd-1.4.19.mod_deflate.patch

#cd lighttpd-1.4.19
#patch -p1 < ../lighttpd-1.4.19.mod_deflate.patch

/* 以下是笨小孩用的方法 */
#diff -C 5 ../lighttpd-1.4.19-org/configure.in configure.in > patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/base.h src/base.h >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/chunk.c src/chunk.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/chunk.h src/chunk.h >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/connections.c src/connections.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/http_chunk.c src/http_chunk.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/joblist.c src/joblist.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/Makefile.am src/Makefile.am >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/Makefile.in src/Makefile.in >> patch-src__mod_deflate.c
#diff -NC 5 ../lighttpd-1.4.19-org/src/mod_deflate.c src/mod_deflate.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/plugin.c src/plugin.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/plugin.h src/plugin.h >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/request.c src/request.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/response.c src/response.c >> patch-src__mod_deflate.c
#diff -C 5 ../lighttpd-1.4.19-org/src/server.c src/server.c >> patch-src__mod_deflate.c

/* 聰明小孩要這樣用 */
#cd ../lighttpd-1.4.19-org
#diff -Naur . ../lighttpd-1.4.19/ >> ../patch-src__mod_deflate.c

放到…/usr/ports/www/lighttpd/files 下

#cp patch-src__mod_deflate.c /usr/ports/www/lighttpd/files
#cd /usr/ports/www/lighttpd ; make clean
#make install

編輯lighttpd.conf

[...]
server.modules              = (
            "mod_access",
            "mod_alias",
            "mod_accesslog",
            "mod_fastcgi",
#           "mod_rewrite",
            "mod_deflate",
#           "mod_redirect",
#           "mod_status",
#           "mod_evhost",
#           "mod_compress",
#           "mod_usertrack",
#           "mod_rrdtool",
#           "mod_webdav",
#           "mod_expire",
#           "mod_flv_streaming",
#           "mod_evasive"
 )
[...]

[...]
deflate.enabled = "enable"
deflate.compression-level = 9
deflate.mem-level = 9
deflate.window-size = 15
# deflate.bzip2 only in patch for 1.4.x
deflate.bzip2 = "enable"
# deflate.allowed_encodings only in 1.5.x
#deflate.allowed_encodings = ( "bzip2", "gzip", "deflate" )
deflate.min-compress-size = 200
#deflate.sync-flush = "enable"
deflate.output-buffer-size = 4096
deflate.work-block-size = 512
deflate.mimetypes = ("text/html", "text/plain", "text/css", "text/javascript", "text/xml")
#deflate.debug = "enable"

然後去這網站看一下結果

http://www.port80software.com/tools/compresscheck?

輸入網站url
看結果

patch 在這
要的請自取
maybe 會進ports 也不一定..
我有send pr了
不知道送的對不對就是了 哈

基於有圖有真相原則
21254

ref:

http://trac.lighttpd.net/trac/wiki/Mod_Deflate

http://www.howtoforge.com/lighttpd_1.4_mod_deflate_debian_etch

http://www.freebsddiary.org/patch.php

http://yblog.org/archive/index.php/5318

PS: ………有r-proxy 下…lighttpd 吐出去的是沒compressed 的……….
白弄了…
要再看看有沒有什麼解法………..

About johnpupu

..........
This entry was posted in FreeBSD and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word