Enable globally LS cache

DoM

Well-Known Member
#1
Hello,
i want enable global cache for all domains on our cPanel servers.

I follow instruction here: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscache:setup-guidline

but no way.

I notice that LS create spool directory for cache in path that i used but those dirs are empty.

I added all rewrite rules directly inside virtualhost of users.

I also notice that in real time stats no files were cached. Cache hit is always zero.


Waiting for your reply

Regards
 

NiteWave

Administrator
#2
in
2. Set Default cache policy at LSWS Server level
Enable Cache:No
Cache Request with Query String:Yes
Cache Request with Cookie:No
Cache Response with Cookie:No
Ignore Request Cache-Control:No

Ignore Response Cache-Control:No
Enable Private Cache: Yes*
Private Cache Expire Time (seconds): 120
try following:
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
Enable Private Cache: No

you may see big difference.
 

DoM

Well-Known Member
#3
Did it but no way.


If i check real time stats about cache they are always zero.

If i check for file inside cache path i do not find any.

Just to be sure:

1) I setup on LSWS > Configuration > Server > Cache following configuration:

Storage Path /my/custom/path/cachedir
Max Object Size 1024000
Enable Cache No
Cache Expire Time (seconds) 86400
Cache Stale Age (seconds) 10
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
Enable Private Cache No
Private Cache Expire Time (seconds) 60


On each virtualhost i added following lines inside:
<VirtualHost...>
...
RewriteEngine On
## cache should be available for HEAD or GET requests
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
## select which pages to cache
RewriteCond %{HTTP_COOKIE} page_contain_cachetoken=yes
# with other condition

RewriteCond %{QUERY_STRING} !s=[a-fA-F0-9]{32}

# excluding certain URLs
RewriteCond %{REQUEST_URI} !/(login|register|usercp|private|profile|cron|image)\.php$

# cache for 2 mins for php pages only
RewriteRule /(.*\.php)?$ – [L,E=Cache-Control:max-age=120]
</VirtualHost>

Where am i wrong ?


Waiting for your reply

Best regards
 

NiteWave

Administrator
#4
vhost level cache policy will override server level policy.

this is the only problem I can see so far.

so to check your vhost level cache policy, if it's similar with server level's.
 

DoM

Well-Known Member
#5
I have cPanel default apache virtualhost configuration.

I do not use LSWS vhost native config.

I do not think there are some directives inside apache vhost configuration that overrides those in mod_rewrite.

If are present rewrite rules in .htaccess files, of course they are not present on each website so i should see some cache statistics inside real time stats of LSWS.

Instead i notice that CXS remove some LSWS files on each LSWS restart operation:

Time: Tue Dec 17 04:33:37 2013 +0100
File: /tmp/lshttpd/.rtreport.*
Reason: Suspicious symlink (->/path/ramdisk/lshttpd/status/.rtreport.3)
Owner: nobody:nobody (99:99)
Action: Symlink removed

There is a way to change LSWS path of these files instead of /tmp/lshttpd ?


Waiting for your reply

Regards
 

NiteWave

Administrator
#6
There is a way to change LSWS path of these files instead of /tmp/lshttpd ?
No, it's not likely possible since it's hard coded in source code.
need very big change I think.

instead, there should be a way to configure CXS, to exclude /tmp/lshttpd from its monitoring list.
 

DoM

Well-Known Member
#7
My fault is NOT CXS but lfd of CSF.

Now i disabled that CSF option, restarted LSWS but on reail time stats i ca not see any info about cache hit.


Waiting for your reply

Regards
 

NiteWave

Administrator
#8
please check permission of
Storage Path /my/custom/path/cachedir
to ensure it's writable for user which running litespeed process.

you can try 777 in test phase.
 

DoM

Well-Known Member
#9
Already did it and already they are 777 with user nobody and group nobody.

ls -lha /path/lshttpd/cache/
total 4.0K
drwxrwxrwx 18 nobody nobody 360 Dec 17 02:16 ./
drwxr-xr-x 6 root root 4.0K Dec 15 16:22 ../
drwx------ 18 nobody nobody 360 Dec 17 02:19 0/
drwx------ 17 nobody nobody 340 Dec 17 02:17 1/
drwx------ 18 nobody nobody 360 Dec 17 02:19 2/
drwx------ 18 nobody nobody 360 Dec 17 02:18 3/
drwx------ 17 nobody nobody 340 Dec 17 02:19 4/
drwx------ 17 nobody nobody 340 Dec 17 02:18 5/
drwx------ 16 nobody nobody 320 Dec 17 02:19 6/
drwx------ 17 nobody nobody 340 Dec 17 02:19 7/
drwx------ 18 nobody nobody 360 Dec 17 02:23 8/
drwx------ 17 nobody nobody 340 Dec 17 02:24 9/
drwx------ 18 nobody nobody 360 Dec 17 02:25 a/
drwx------ 15 nobody nobody 300 Dec 17 02:21 b/
drwx------ 18 nobody nobody 360 Dec 17 02:18 c/
drwx------ 18 nobody nobody 360 Dec 17 02:20 d/
drwx------ 18 nobody nobody 360 Dec 17 02:19 e/
drwx------ 18 nobody nobody 360 Dec 17 02:20 f/

Dirs were created but no files inside.
 

DoM

Well-Known Member
#10
Solved

Ok just to let you know it works but i have to enable cache instead of your previous instructions:

1) I setup on LSWS > Configuration > Server > Cache following configuration:

Enable Cache Yes


Best regards
 
Top