[solved] vBulletin + LiteSpeed Cache

andych

Well-Known Member
#25
it is now enabled and still having the same issue :confused:

need assistance asap as it is on a production environment :(

Code:
[i]root@eden:~# [b]cat /var/www/.htaccess[/b][/i]
#php_flag suhosin.cookie.encrypt Off
#php_value suhosin.request.max_vars 2048
#php_value suhosin.post.max_vars 2048

order allow,deny
allow from all

deny from 1.2.3.4 #bad-ips

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{http_host} ^my.dom
RewriteRule ^(.*) http://www.my.dom/$1 [R=301,L]

RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
RewriteCond %{HTTP_COOKIE} !bbuserid=
RewriteCond %{HTTP_COOKIE} !bbpassword=

RewriteCond %{HTTP_COOKIE} !if_imloggedin=yes
RewriteCond %{HTTP_COOKIE} !if_userid=
RewriteCond %{HTTP_COOKIE} !if_password=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
RewriteCond %{REQUEST_URI} !^/admincp
RewriteRule (.*) - [E=Cache-Control:max-age=120]

# RewriteRule /test.php - [L,E=Cache-Control:max-age=120]

RewriteRule ^home/$ forum.php [L,R=301]
RewriteRule ^f([0-9]+)/$ forumdisplay.php?f=$1 [L,R=301]
RewriteRule ^f([0-9]+)-([0-9]+)/$ forumdisplay.php?f=$1&page=$2 [L,R=301]
RewriteRule ^t([0-9]+)/$ showthread.php?t=$1 [L,R=301]
RewriteRule ^t([0-9]+)-([0-9]+)/$ showthread.php?t=$1&page=$2 [L,R=301]
RewriteRule ^t([0-9]+)-print/$ showthread.php?t=$1 [L,R=301]
RewriteRule ^blogs/u([0-9]+)-e([0-9]+)/$ entry.php?b=$2 [L,R=301]
[i]root@eden:~# [/i]
 
Last edited:
#26
there is an extra space in line:
RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image) \.php$
before \.php$.
please remove it

and please remove the 3 lines:
RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
RewriteCond %{HTTP_COOKIE} !bbuserid=
RewriteCond %{HTTP_COOKIE} !bbpassword=
sine your cookie is start from if_
 

andych

Well-Known Member
#27
Code:
[I]root@eden:~#[/I] [I][B]cat /var/www/.htaccess[/B][/I]
#php_flag suhosin.cookie.encrypt Off
#php_value suhosin.request.max_vars 2048
#php_value suhosin.post.max_vars 2048

order allow,deny
allow from all

deny from 1.2.3.4 #bad-ips

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{http_host} ^my.dom
RewriteRule ^(.*) http://www.my.dom/$1 [R=301,L]

#removed 3 lines below by request of NiteWave@LS 20130514 1157.G+7
#RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
#RewriteCond %{HTTP_COOKIE} !bbuserid=
#RewriteCond %{HTTP_COOKIE} !bbpassword=

RewriteCond %{HTTP_COOKIE} !if_imloggedin=yes
RewriteCond %{HTTP_COOKIE} !if_userid=
RewriteCond %{HTTP_COOKIE} !if_password=
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}
RewriteCond %{QUERY_STRING} !product=vbnexus
RewriteCond %{REQUEST_URI} !^/(login|register|usercp|private|profile|cron|image)\.php$
RewriteCond %{REQUEST_URI} !^/admincp
RewriteRule (.*) - [E=Cache-Control:max-age=120]

# RewriteRule /test.php - [L,E=Cache-Control:max-age=120]

RewriteRule ^home/$ forum.php [L,R=301]
RewriteRule ^f([0-9]+)/$ forumdisplay.php?f=$1 [L,R=301]
RewriteRule ^f([0-9]+)-([0-9]+)/$ forumdisplay.php?f=$1&page=$2 [L,R=301]
RewriteRule ^t([0-9]+)/$ showthread.php?t=$1 [L,R=301]
RewriteRule ^t([0-9]+)-([0-9]+)/$ showthread.php?t=$1&page=$2 [L,R=301]
RewriteRule ^t([0-9]+)-print/$ showthread.php?t=$1 [L,R=301]
RewriteRule ^blogs/u([0-9]+)-e([0-9]+)/$ entry.php?b=$2 [L,R=301]
[I]root@eden:~#[/I]
Are you the one that added 3 lines below ?
Code:
RewriteCond %{HTTP_COOKIE} !if_imloggedin=yes
RewriteCond %{HTTP_COOKIE} !if_userid=
RewriteCond %{HTTP_COOKIE} !if_password=
 
#30
from the screenshot, it's correct result.
please look at the cookie from the screenshot:
if_usrid=1
if_password=...
when these strings exist in cookie, indicate that this is a logged in user, so NOT return the cache. cache is for guest only.
so you just logout and visit your forum again as a guest, you'll see the cache hit header.

another suggestion : now guest cache time set to 120 seconds(i.e., 2 minutes), you can increase it to 5 minutes, 10/15/30 etc, since the cache is for guest users only.
this will improve the performance for both guest and logged in users. people will feel your forum faster, response quickly.
 
Last edited:

andych

Well-Known Member
#31
I see, just want to confirm that: after user logged in, the cache is not caching and only caching for guests (not logged in users) ?

Ps: Where I can set the guest cache time?
 

andych

Well-Known Member
#33
Thank you very much for your assistance, NiteWave.. Now I see everything's clear :D

I've set to 'RewriteRule (.*) - [E=Cache-Control:max-age=300]' (5 Minutes)

And I see:
Code:
RewriteCond %{REQUEST_URI} !^/admincp
on .htaccess, do I have to add the /modcp as well?
 
Last edited:

andych

Well-Known Member
#35
Thanks for confirming, I've added:
Code:
RewriteCond %{REQUEST_URI} !^/modcp
Now it's working as expected, once again thank you for your kind assistance NiteWave!

Have a great day always!
 
#37
current algorithm,
Cache Hit Rate = Total Cache Hits / Total Req = 1,288/17,574 = 7.33%

but since lsws don't cache static content, like .css/.js/.jpg etc, but these static content also counts as Req, so the cache hit rate looks low.
 
#39
lsws don't cache static content since it's not needed at all or in most scenarios.
lsws serve static content quickly and consume little system resource.
when a static content i.e., an image is requested repeatedly, linux may cache the image in memory, so lsws serve the image more quickly. it's automatic, and won't consume lsws process's own memory. so if lsws serve static contents only, you will notice lsws process keep on low memory and low load all the time and yet very fast. or in other words, the static contents are cached by linux kernel automatically. lsws just make good use of the linux kernel file system's great efficiency. if you wish some static content always in cache(or memory), you can put these files under /dev/shm, no need ask lsws to put it in memory as well.
 
Top