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

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

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

[sourcecode language=’sh’]
#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
[/sourcecode]

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

[sourcecode language=’sh’]
#cp patch-src__mod_deflate.c /usr/ports/www/lighttpd/files
#cd /usr/ports/www/lighttpd ; make clean
#make install
[/sourcecode]

編輯lighttpd.conf

[sourcecode language=’c’]
[…]
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”

[/sourcecode]

然後去這網站看一下結果
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 的……….
白弄了…
要再看看有沒有什麼解法………..

發佈留言

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料