Enable globally LS cache

Discussion in 'LiteSpeed Cache' started by DoM, Dec 16, 2013.

  1. DoM

    DoM New Member

    Hello,
    i want enable global cache for all domains on our cPanel servers.

    I follow instruction here: http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:litespeed:cache

    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
  2. NiteWave

    NiteWave Administrator

    in
    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.
  3. DoM

    DoM New Member

    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
  4. NiteWave

    NiteWave Administrator

    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.
  5. DoM

    DoM New Member

    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
  6. NiteWave

    NiteWave Administrator

    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.
  7. DoM

    DoM New Member

    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
  8. NiteWave

    NiteWave Administrator

    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.
  9. DoM

    DoM New Member

    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.
  10. DoM

    DoM New Member

    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

Share This Page