
01-12-2011, 06:53 PM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,297
|
|
1.install vBulletin plug-in(or "vBulletin Boost Product XML")
product-boostv1.xml
please refer the first post in this thread, to get the file's link and download it(currently, it's 657 views)
2.set cache directory
lsws admin console-->Server-->Cache:
Cache Storage Settings->Storage Path:/tmp/diskcache (just for example)
please create this directory in shell:
#mkdir /tmp/diskcache
#chown nobody:nobody /tmp/diskcache
#chmod 700 /tmp/diskcache
(assume litespeed(or lshttpd) process is running as nobody)
3. set vhost's "Cache Policy"
assume vBulletin is natively configured as a lsws vhost "myforum"
lsws admin console->Virtual Hosts->myforum->Cache:
Code:
Enable Cache:No
Cache Request with Query String:Yes
Cache Request with Cookie:Yes
Cache Response with Cookie:Yes
Ignore Request Cache-Control:Yes
Ignore Response Cache-Control:Yes
4.use rewriterule to cache php pages which you want to
lsws admin console->Virtual Hosts->myforum->Rewrite:
(assume vBulletin installed in $DOCUMENT_ROOT/forum)
Quote:
##%## following redirect will reduce cached files:
######## otherwise domain.com/abc.php and www.domain.com/abc.php will create 2 cache files.
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule /forum/(.*)$ http://www.domain.com/forum/$1 [R=301,L]
## select which pages to cache
RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
RewriteCond %{HTTP_COOKIE} !bbuserid=
RewriteCond %{HTTP_COOKIE} !bbpassword=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^/forum/(login|register|usercp|private|profile|cron|image) \.php$
RewriteCond %{REQUEST_URI} !^/forum/admincp
RewriteRule /forum/(.*\.php)?$ - [L,E=Cache-Control:max-age=120]
|
5. restart litespeed
Note: you may need set a cron job to clean up cace directory /tmp/diskcache. following script is borrowed from $SERVER_ROOT/admin/misc/cleancache.sh:
Code:
*/10 * * * * root find /tmp/diskcache -type f -mmin +8 -delete 2>/dev/null
delete cache which created 8 minutes ago(running once every 10 minutes). since we set cache expire time as 120 seconds(2 minutes), so it's safe to delete these cache files.
Last edited by NiteWave; 01-12-2011 at 07:51 PM..
|