LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > LiteSpeed Cache > vB seo + litespeed cache

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-21-2011, 10:40 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
Default 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..
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:15 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.