HOBALL 筆記簿

May 28, 2010

Enabling mod_mem_cache in Lighttpd 1.4.26

Filed under: Linux — Tags: , — hoball @ 12:31 pm

@reference:
http://blog.liuts.com/post/63/
http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModMemCache

Make sure you have the lighttpd 1.4.26 source

Check if the patch binary is installed

yum -y update patch

cd ~/lighttpd-1.4.26

Download the patch file from http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModMemCache

wget http://redmine.lighttpd.net/attachments/download/1086/lighttpd-1.4.x-svn-mod_mem_cache.patch
patch -p1 < ./lighttpd-1.4.x-svn-mod_mem_cache.patch

./configure –with-fam –with-pcre –with-zlib –with-bzip2 –with-openssl –sbindir=/usr/sbin –sysconfdir=/etc/lighttpd
make
make install

If successful, edit /etc/lighttpd/lighttpd.conf

server.modules += (“mod_mem_cache”)
mem-cache.enable = “enable”
mem-cache.filetypes = (
“text/css”,
“text/html”,
“text/javascript”,
“application/x-javascript”,
“image/gif”,
“image/jpeg”,
“image/jpeg”,
“image/png”,
“image/x-xbitmap”,
“image/x-xpixmap”,
“image/x-xwindowdump”,
)
mem-cache.max-memory = 128 # in Megabytes
mem-cache.max-file-size = 256 # in Kilobytes
mem-cache-expire-time = 1440 # in seconds

Restart Lighttpd

/sbin/service lighttpd restart

Check for error messages

tail /var/log/lighttpd/error.log

If no error, check the Lighttpd mod_status config page

Loaded modules: mem_cache

Statistics of the memory cache is in mod_status statistics page

mem-cache.cachenumber: 518
mem-cache.hitpercent: 56
mem-cache.usedmemory: 6960064 (should be in bytes)

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: