|
|

03-21-2011, 10:40 PM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,296
|
|
vB seo + litespeed cache
We've enable litespeed cache on a living vB seo site successfully, the load dropped a lot during peak time, response has become faster.
vBulletin 4.1.2
vBSEO 3.6.0
litespeed 4.0.20
1. the cache plugin for vBulletin 3/4
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="lswscache" active="1">
<title>Litespeed Caching</title>
<description>settings to make Litespeed page cache working right</description>
<version>1.0</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1" executionorder="1">
<title>Unset session id for guest users</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[if($vbulletin->userinfo['userid'] <= 0)
{
$vbulletin->session->vars['sessionurl'] = '';
$vbulletin->session->vars['sessionurl_q'] = '';
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="1">
<title>SET COOKIE FOR LOGGED IN USERS</title>
<hookname>login_verify_success</hookname>
<phpcode><![CDATA[if ($send_cookies AND $cookieuser)
{
// Cookie user
vbsetcookie('imloggedin', 'yes', true, true, true);
}
else
{
// Not permanent
vbsetcookie('imloggedin', 'yes', false, true, true);
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="1">
<title>Send X-LiteSpeed-Cache-Control header for logged in users</title>
<hookname>style_fetch</hookname>
<phpcode><![CDATA[// Do not cache logged in user pages
if ( $vbulletin->userinfo['userid'] )
{
header('X-LiteSpeed-Cache-Control: no-cache');
};]]></phpcode>
</plugin>
</plugins>
<phrases>
</phrases>
<options>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>
save above code as litespeed_cache.xml, and using
vBulletin Admin Control Panel(/admincp)->
Plugins & Products->
Add/Import Product
to import above .xml.
2.rewrite rule in vBulletin's home directory .htaccess
#VBSEO -- original vbseo rules
....
RewriteRule ^(.+)$ vbseo.php [L,QSA]
===>
RewriteRule ^(.+)$ vbseo.php [QSA]
#rules for litespeed cache:
RewriteCond %{HTTP_COOKIE} !vbseo_loggedin=yes
RewriteCond %{HTTP_COOKIE} !bb_userid=
RewriteCond %{HTTP_COOKIE} !bb_password=
#RewriteCond %{ORG_REQ_URI} ^/(index\.php|)$
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} ^$
RewriteRule (.*) - [L,E=Cache-Control:max-age=60]
note:
1. in fact nothing new here, just put all pieces together to make it simple
2. the vBulletin plugin is based on the vB plugin for varnish as we always mentioned in past posts/blog.
Boosting vBulletin Performance with Advanced Caching,the attached file product-boostv1.xml
Last edited by NiteWave; 03-21-2011 at 10:51 PM..
|

03-25-2011, 02:00 PM
|
|
Senior Member
|
|
Join Date: Apr 2009
Posts: 160
|
|
bit confusing for me , i created and installed plugin as mentioned, but struck at .htaccess i presently have this what should be there instead of it :-
Code:
# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On
# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.org$
RewriteRule ^/?$ "http\:\/\/www\.mysite\.org\/index\.php" [R=301,L]
RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]
just quote me what has to be there in that .htaccess file
thanks.
|

03-25-2011, 09:57 PM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,296
|
|
|
the last line of your rewrite rule is
RewriteRule ^(.+)$ vbseo.php [L,QSA]
remove the "L", change to
RewriteRule ^(.+)$ vbseo.php [QSA]
then add those rules follow
#rules for litespeed cache:
in my first post to your .htaccess
|

04-01-2011, 03:19 AM
|
|
Senior Member
|
|
Join Date: Jan 2008
Posts: 65
|
|
|
As I understand we need 2cpu license to support that, correct?
|

04-01-2011, 03:58 AM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,296
|
|
|
|

05-24-2011, 12:20 PM
|
|
New Member
|
|
Join Date: May 2011
Posts: 9
|
|
|
I tried these settings without any luck. Only difference is I'm using 3.8.
|

04-17-2012, 09:10 AM
|
|
Member
|
|
Join Date: Apr 2012
Posts: 41
|
|
|
I used vbulletin too, and litespeed with 2 cpu license, can 2 cpu license do caching?
I don't use vbseo, do i need to use htaccess on first post too?
|

04-17-2012, 09:59 AM
|
|
LiteSpeed Staff
|
|
Join Date: Oct 2010
Posts: 2,390
|
|
|
2-CPU license supports caching.
yes, for vb, you still need the plugin and rewrite rules in .htaccess as shown in the 1st post.
|

04-17-2012, 10:26 AM
|
|
Member
|
|
Join Date: Apr 2012
Posts: 41
|
|
Quote:
Originally Posted by webizen
2-CPU license supports caching.
yes, for vb, you still need the plugin and rewrite rules in .htaccess as shown in the 1st post.
|
thanks i've tried it.. is there any way to test whether the litespeed caching works?
|

04-17-2012, 12:56 PM
|
|
LiteSpeed Staff
|
|
Join Date: Oct 2010
Posts: 2,390
|
|
|
LiteSpeed outputs a response header “X-LiteSpeed-Cache: hit” if a request is served from cache.
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 10:32 PM.
|
|