LiteSpeed Cache + PhpFox

Discussion in 'LiteSpeed Cache' started by LowKey, Dec 27, 2012.

  1. LowKey

    LowKey New Member

    Hello,

    Successful enable LiteSpeed Cache, but i'm having one problem with the phpfox website.

    After i'm added RewriteRule cache .htacesss

    RewriteRule (.*\.php)?$ - [L,E=Cache-Control:max-age=120]

    The server seems very fast and cache is working, but one problem is the session user changed to another user. Which mean i'm as administrator/admin change to another user. (Session ID changing)
    I'm don't know, why this happen?

    I'm disable cache by commented out # on .htaccess.

    It's back to normal,but no cache apply from LiteSpeed.

    Hope LiteSpeed Staff can look at my issue.

    Here my cache setting on LiteSpeed

    Storage Path /dev/shm/lsdiskcache
    Max Object Size Not Set

    Enable Cache No
    Cache Expire Time (seconds) Not Set
    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) 120

    Note : I'm applying LiteSpeed with PHPFox.

    Thanks.
    Last edited: Dec 27, 2012
  2. mistwang

    mistwang LiteSpeed Staff

    You can only use private cache for login user, public cache for guest visitors.
    Please read more about our wikis.
  3. imohsen

    imohsen New Member


    in some of softwares that based on cookies this options may cause some weired problems .
    so set it to no and take a shot !

  4. LowKey

    LowKey New Member

    I'm follow the setting,

    but getting error :

    404 Not Found
    The resource requested could not be found on this server!

    Can't open the website. Please help :)


    Thanks.
  5. NiteWave

    NiteWave Administrator

  6. LowKey

    LowKey New Member

    Hello,

    Seems i'm successful apply cache,

    I'm put this on .htaccess

    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]

    and the website running, without any error dumped on error_log.

    However this is public cache right ? I have question how to check whether this is already cached by LiteSpeed Cache or I'm also using CloudFlare .

    I'm need guide how to make private cache also.

    #Update1

    VH Name Req in Processing Req/Sec Total Req Total Cache Hits Cache Hits/Sec Output Bandwidth ExtApp Processes EAProc In Use EAProc Idle EAProc WaitQ EAProc Req/Sec
    APVH_xxx.net 110 118.4 31,136 0 0.0 0 2 10 0 100 109

    Total Cache Hits : 0 <-- still not working.

    Thanks.
    Last edited: Dec 28, 2012
  7. NiteWave

    NiteWave Administrator

    please refer:
    http://blog.litespeedtech.com/2011/01/28/speed-up-vbulletin-sites-through-litespeed-built-in-cache/
    can check the header in firebug.

    you're right. this number tell you the cache hits number.
    Last edited: Dec 28, 2012
  8. LowKey

    LowKey New Member

    Hello,

    Unfortunately, i can't see any response header response header “X-LiteSpeed-Cache hit”

    I'm using FireBug to check the header.
  9. webizen

    webizen New Member

  10. webizen

    webizen New Member

    Try:

    RewriteRule (.*\.php)?$ – [L,E=Cache-Control:max-age=120]
    # leading "/" should be removed in .htaccess
  11. LowKey

    LowKey New Member

    Hi,

    Still got issue
    --
    RewriteBase /
    RewriteRule (.*\.php)?$ – [L,E=Cache-Control:max-age=120]
    --
    After applied , the website become ;

    404 Not Found

    The resource requested could not be found on this server!
    Powered By LiteSpeed Web Server
    LiteSpeed Technologies is not responsible for administration and contents of this web site!
  12. webizen

    webizen New Member

    Enable rewrite logging (add "RewriteLogLevel 9" in vhost of httpd.conf), restart lsws to make it effective. Then grep /usr/local/apache/logs/error_log with REWRITE to find out where that 404 comes from.
  13. LowKey

    LowKey New Member

    I'm enable RewriteLogLevel 9 on httpd.conf and restarted lsws.

    Just got this dumped. Nothing REWRITE error dumped on error_log
    2012-12-28 21:52:28.078 [INFO] [103.22.201.25:14375-0#APVH_xxx.net] File not found [/home/xxx/public_html/404.shtml]
    2012-12-28 21:52:28.113 [INFO] [103.22.201.127:36960-0#APVH_xxx.net] File not found [/home/xxx/public_html/...]

    Not sure why this happen.
  14. LowKey

    LowKey New Member

    Here some information

    top - 22:26:05 up 12 days, 7:43, 4 users, load average: 1.12, 0.64, 0.81
    Tasks: 283 total, 1 running, 282 sleeping, 0 stopped, 0 zombie
    Cpu(s): 10.0%us, 2.1%sy, 0.0%ni, 87.7%id, 0.2%wa, 0.0%hi, 0.0%si, 0.0%st
    Mem: 24605732k total, 19208184k used, 5397548k free, 975168k buffers
    Swap: 12386288k total, 38064k used, 12348224k free, 15598724k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    9 root 20 0 0 0 0 S 26.9 0.0 1037:37 ksoftirqd/1
    7083 nobody 20 0 201m 23m 15m S 26.9 0.1 0:10.52 lsphp5
    26827 mysql 15 -5 6156m 554m 7240 S 25.9 2.3 4:59.91 mysqld
    4 root 20 0 0 0 0 S 24.9 0.0 1443:18 ksoftirqd/0
    7479 nobody 20 0 200m 19m 12m S 12.3 0.1 0:00.75 lsphp5
    7460 nobody 20 0 198m 19m 14m S 11.6 0.1 0:02.35 lsphp5
    25 root 20 0 0 0 0 S 6.0 0.0 270:04.10 ksoftirqd/5
    7149 nobody 20 0 203m 24m 15m S 4.3 0.1 0:05.52 lsphp5
    13 root 20 0 0 0 0 S 3.3 0.0 721:29.60 ksoftirqd/2
    7458 nobody 20 0 198m 16m 11m S 2.7 0.1 0:00.86 lsphp5
    17 root 20 0 0 0 0 S 1.7 0.0 882:15.09 ksoftirqd/3
    21 root 20 0 0 0 0 S 1.0 0.0 393:56.21 ksoftirqd/4
    6178 nobody 16 -4 110m 4932 2328 S 1.0 0.0 0:01.25 litespeed
    7468 nobody 20 0 200m 19m 12m S 1.0 0.1 0:01.07 lsphp5
    7477 nobody 20 0 202m 22m 13m S 0.7 0.1 0:00.44 lsphp5
    29 root 20 0 0 0 0 S 0.3 0.0 950:26.22 ksoftirqd/6

    1) sudo -u nobody cat /home/marsha/public_html/.htaccess [passed]
    2) sudo -u marsha cat /home/marsha/public_html/.htaccess [passed]

    both can sudo and show the content .htaccess

    i also using tutorial http://www.bestdesigns.co.in/blog/create-apache-rewrite-log-file

    but still Rewrite error not show up.
  15. LowKey

    LowKey New Member

    Hi,

    After a few testing now, REWRITE error show up

    .htaccess setting
    Please check

    Thanks
  16. webizen

    webizen New Member

    Your rewrite rule is wrong.

    Change below

    To

  17. LowKey

    LowKey New Member

    Hi,

    After change to the correct .htaccess rules as you mention

    My website become unresponsive


    and the Load average slightly become high load average.

    Here my cahce policy on the server

    Is that correct ?

    Please let me know


    Thanks.
  18. webizen

    webizen New Member

    Your PHP engine is not responding. This has nothing to do with LS Caching. Did you build matching PHP? Also check stderr.log for any indication.

    Regarding your cache policy, you should set Enable Cache to No in order to use rewrite rule for caching.
  19. LowKey

    LowKey New Member

    Yes, I'm build matching PHP.

    Still same issue after Enable Cache set to No

    Still same issue happen, There is any other idea?

    Thanks
  20. LowKey

    LowKey New Member

    Good News,

    Today, i'm got my LS Cache working. Yes, but it's just help a little, maybe need to working more on this. At least this the page load seems fastest than before.

    This is my cache rules on .htaccess
    This rules was working to cache PHPFox, at "Home" page , make the "Home" page load faster.

    Here some screenshot :

    http://cl.ly/image/1i1e1a3n1Z3S
    http://cl.ly/image/0m0d0q2f1U2h
    http://cl.ly/image/3g2B1j3W011G

    I got Cache Hits/Sec : 1.0
    Total Cache Hits : 6,545
    Total Request : 1,904,511

    Seem not fully cached yet on the whole website, but i'm need some help about understanding the rules.

    I need help for cache this url
    http://www.xxx.net/user/login
    Path : /home/xxx/www/module/user

    How to exclude this url from LS Cache ?
    If, my current is wrong, please let me know. so we can simply it.

    Glad to hear from you

    Thanks.

Share This Page