vBulletin Guest Cache with LiteSpeed

dihuta

Well-Known Member
#1
Hello,

IBxAnders've just wrote an Blog entry to guide how to use Varnish for Output Caching for vBulletin Guest Pages (ie. index.php and content.php).

URL: vbulletin.com/forum/entry.php?2440-vB4Mance-Part-5-Expert-Level-Boosting-vBulletin-Performance-with-Advanced-Caching

I see LiteSpeed have a powerfuil Output Caching lite Varnish. But I don't know how to do with LiteSpeed. Could you please help to config this.

Doing this will help much vBulletin Forum Owner can decrease high load by using LiteSpeed mod_cache.

Thank you so much.
 

NiteWave

Administrator
#2
Hello dihuta, wish you're still monitoring this thread.

We've tried to cache this vBulletin(litespeed support forum) for guest visits for some days and looks successful so far. Just using the way you mentioned in your post: install a vBulletion plugin first, then using litespeed's unique rewrite+cache function to get it done.

It's far more simple and strait-forward than apache + varnish, we'd discuss/help with our users how to implement it under litespeed.
 

eva2000

Well-Known Member
#3
awesome news, get a guide/how to post up for all of us to try so we can provide feedback :D

Guess next popular apps to test this for would be

1. wordpress
2. drupal
3. openx
4. photopost
5. reviewpost

:D
 

dihuta

Well-Known Member
#4
It's so great to hear this!
Could you please help me how to do this in step by step?
Can't wait to try this.

Thank you so much.


Hello dihuta, wish you're still monitoring this thread.

We've tried to cache this vBulletin(litespeed support forum) for guest visits for some days and looks successful so far. Just using the way you mentioned in your post: install a vBulletion plugin first, then using litespeed's unique rewrite+cache function to get it done.

It's far more simple and strait-forward than apache + varnish, we'd discuss/help with our users how to implement it under litespeed.
 

NiteWave

Administrator
#5
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)

##%## 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:

eva2000

Well-Known Member
#6
What if virtualhost is via apache on whm/cpanel based litespeed server ? Would vbseo rewrites interfere with this ?

thanks
 

NiteWave

Administrator
#7
rewriterule has no difference. but need put it in httpd.conf, vhost definition section. it's ok to put the rewriterule in .htaccess as well. just need some minor adjustment, since the per server and per directory rewriterule difference.
 

dihuta

Well-Known Member
#8
I have Litespeed + DirectAdmin. There is no vhost item in Virtual Host list. So where exactly to put these lines? (httpd.conf?)

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


Thank you.

3. set vhost's "Cache Policy"
assume vBulletin is natively configured as a lsws vhost "myforum"
lsws admin console->Virtual Hosts->myforum->Cache:
 

eva2000

Well-Known Member
#9
rewriterule has no difference. but need put it in httpd.conf, vhost definition section. it's ok to put the rewriterule in .htaccess as well. just need some minor adjustment, since the per server and per directory rewriterule difference.
thanks

For that rewrite url set, how would it be modified to also exclude individual non-vB php pages i.e.


domain.com/about.php
domain.com/contact.php

or exclude wordpress specific pages/directories

domain.com/wordpress
domain/wp-content/

etc ?
 
#10
dihuta:
please try same settings at server level in your case, then try rewriterule cache, see if it works.

eva2000:
for wordpress, I think wordpress's plug-in: wp super cache(or w3 total cache?) is better, please use it instead. why? since it generate static pages --- that means, if a post has no update, the static page no update too, the static pages won't expire until the post has update. for litespeed cache, as you can see, have to set a expire time, say 120 seconds, or 600 seconds, etc. after it expires, have to re-generate cache again even the original php page has no change at all.
 

eva2000

Well-Known Member
#11
oh my mistake I forgot you have global cache disabled in litespeed above config, as i thought the rewrite rule would cache all php pages which arent excluded by the rewrite rule. But since you have global cached disabled it wouldn't touch other scripts. Pretty neat that you can fine tune what specifically get's cached with global cache disabled :)
 

eva2000

Well-Known Member
#12
Hello dihuta, wish you're still monitoring this thread.

We've tried to cache this vBulletin(litespeed support forum) for guest visits for some days and looks successful so far. Just using the way you mentioned in your post: install a vBulletion plugin first, then using litespeed's unique rewrite+cache function to get it done.

It's far more simple and strait-forward than apache + varnish, we'd discuss/help with our users how to implement it under litespeed.
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)
just to clarify you tried this on vB4.x forum or vB 3.8.6 ?
 

dihuta

Well-Known Member
#17
These setting conflit with VBSEO.
If I put rewriterute before vbseo rules, VBSEO will not work, vice versa, Cache will not work.

Please help me.
Thank you.

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)


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.
 
#18
sorry, we may not able to help with vbseo, since this forum haven't installed it. Here we mainly demonstrate lsws's unique rewriterule+cache function, in example of vBulletin which happen to be running as litespeed support forum.
 

eva2000

Well-Known Member
#19
dihuta, might want to ask on vbseo by posting on their forums the above litespeed/cache rewrite rules and see where the conflict is ? I believe vbseo has it's own cookies for logged in users called vbseo_loggedin = yes
 

dihuta

Well-Known Member
#20
Thanks Eva2000,
I will do it now.


dihuta, might want to ask on vbseo by posting on their forums the above litespeed/cache rewrite rules and see where the conflict is ? I believe vbseo has it's own cookies for logged in users called vbseo_loggedin = yes
 
Top