LiteSpeed Cache + PhpFox

#1
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:
#3
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.

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

Cache Request with Cookie Yes
Cache Response with Cookie Yes
 
#4
in some of softwares that based on cookies this options may cause some weired problems .
so set it to no and take a shot !
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.
 
#6
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:

NiteWave

Administrator
#7
I have question how to check whether this is already cached by LiteSpeed Cache
please refer:
http://blog.litespeedtech.com/2011/01/28/speed-up-vbulletin-sites-through-litespeed-built-in-cache/
7. Verify if pages are served from the cache

Since 4.0.19, LiteSpeed will output a response header 'X-LiteSpeed-Cache hit' if the content is served from its internal cache.
can check the header in firebug.

Total Cache Hits : 0 <-- still not working.
you're right. this number tell you the cache hits number.
 
Last edited:
#8
Hello,

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

I'm using FireBug to check the header.
 
#11
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!
 

webizen

Well-Known Member
#12
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
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.
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
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
Hi,

After a few testing now, REWRITE error show up

2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] [REWRITE] strip base: '/' from URI: '/static/ajax.php'
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] [REWRITE] Rule: Match 'static/ajax.php' with pattern '(.*\.php)?$', result: 2
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] [REWRITE] apply cache-control: 'max-age=120'.
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] [REWRITE] Source URI: 'static/ajax.php' => Result URI: '..#'
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xx.net] [REWRITE] Last Rule, stop!
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] [REWRITE] prepend rewrite base: '/', final URI: '/..#'
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] File not found [/home/marsha/public_html/...]
2012-12-29 04:49:08.271 [INFO] [103.22.201.131:32034-0#APVH_xxx.net] File not found [/home/marsha/public_html/404.shtml]
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] [REWRITE] strip base: '/' from URI: '/static/ajax.php'
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] [REWRITE] Rule: Match 'static/ajax.php' with pattern '(.*\.php)?$', result: 2
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] [REWRITE] apply cache-control: 'max-age=120'.
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] [REWRITE] Source URI: 'static/ajax.php' => Result URI: '..#'
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] [REWRITE] Last Rule, stop!
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] [REWRITE] prepend rewrite base: '/', final URI: '/..#'
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] File not found [/home/marsha/public_html/...]
2012-12-29 04:49:08.281 [INFO] [103.22.201.125:21705-0#APVH_xxx.net] File not found [/home/marsha/public_html/404.shtml]
2012-12-29 04:49:08.289 [INFO] [103.22.201.131:60088-4#APVH_xxx.net] [REWRITE] strip base: '/' from URI: '/static/ajax.php'
2012-12-29 04:49:08.289 [INFO] [103.22.201.131:60088-4#APVH_xxx.net] [REWRITE] Rule: Match 'static/ajax.php' with pattern '(.*\.php)?$', result: 2
2012-12-29 04:49:08.289 [INFO] [103.22.201.131:60088-4#APVH_xxx.net] [REWRITE] apply cache-control: 'max-age=120'.
.htaccess setting
######################################
## [PHPFOX_HEADER]
##
## @copyright [PHPFOX_COPYRIGHT]
## @author Raymond Benc
## @package PhpFox
## @version $Id: htaccess.txt 4580 2012-07-31 15:19:24Z Raymond_Benc $
######################################

# Options -Indexes
# Header unset Pragma
# FileETag None
# Header unset ETag

# URL Rewrite
<IfModule mod_rewrite.c>
RewriteEngine On

#
# Full path to your site
#
RewriteBase /
RewriteRule (.*\.php)?$ – [L,E=Cache-Control:max-age=120]
# Rename Photo Names
# RewriteRule ^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)_([0-9]*?)\.(.*)$ file/pic/photo/$1/$2/$3_$5.$6
# RewriteRule ^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)\.(.*)$ file/pic/photo/$1/$2/$3.$5

#
# Rules
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?do=/$1

# Image Access Protection
# RewriteRule ^file/pic/photo/(.*)\.(.*)$ static/image.php?file=$1&ext=$2
</IfModule>
Please check

Thanks
 
#17
Hi,

After change to the correct .htaccess rules as you mention

My website become unresponsive

2012-12-31 23:41:18.008 [INFO] [HTAccess] Configuration file [/home/marsha/public_html/.htaccess] changed.
2012-12-31 23:41:18.008 [INFO] [HTAccess] Updating configuration from [/home/marsha/public_html/.htaccess]
2012-12-31 23:41:18.009 [INFO] [103.22.201.131:37478-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock.171] on request #0, confirmed, 0, associated process: 1
8714, running: 1, error: Resource temporarily unavailable!
2012-12-31 23:41:18.016 [INFO] [103.22.201.131:37478-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock.171] on request #0, confirmed, 0, associated process: 1
8714, running: 1, error: Resource temporarily unavailable!
2012-12-31 23:41:18.033 [INFO] [103.22.201.131:37478-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock.171] on request #0, confirmed, 0, associated process: 1
8714, running: 1, error: Resource temporarily unavailable!
2012-12-31 23:41:18.047 [INFO] [103.22.201.131:37478-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock.171] on request #0, confirmed, 0, associated process: 1
8714, running: 1, error: Resource temporarily unavailable!

and the Load average slightly become high load average.

Here my cahce policy on the server

Enable Cache Yes
Cache Expire Time (seconds) 300
Cache Request with Query String No
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
Is that correct ?

Please let me know


Thanks.
 

webizen

Well-Known Member
#18
...

2012-12-31 23:41:18.009 [INFO] [103.22.201.131:37478-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock.171] on request #0, confirmed, 0, associated process: 1
8714, running: 1, error: Resource temporarily unavailable!
2012-12-31 23:41:18.016 [INFO] [103.22.201.131:37478-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock.171] on request #0, confirmed, 0, associated process: 1
8714, running: 1, error: Resource temporarily unavailable!

...
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
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.
Yes, I'm build matching PHP.

Still same issue after Enable Cache set to No
2013-01-04 00:54:29.664 [STDERR] 7941: packetLen < 0
2013-01-04 00:54:30.525 [STDERR] 8585: packetLen < 0
2013-01-04 00:54:32.613 [STDERR] 8323: packetLen < 0
2013-01-04 00:54:34.401 [STDERR] 7896: packetLen < 0
2013-01-04 00:54:34.401 [STDERR] 8457: packetLen < 0
2013-01-04 00:54:35.584 [INFO] [49.124.58.46:54289-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock] on request #3, confirmed, 0, associated process: 7253, running: 1, error: Broken pipe!
2013-01-04 00:54:35.590 [INFO] [108.162.222.250:19746-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock] on request #4, confirmed, 0, associated process: 7253, running: 1, error: Broken pipe!
2013-01-04 00:54:37.286 [STDERR] 8587: packetLen < 0
2013-01-04 00:54:38.329 [STDERR] 7999: packetLen < 0
2013-01-04 00:54:38.757 [INFO] [175.143.153.228:53473-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock] on request #0, confirmed, 0, associated process: 7253, running: 1, error: Resource temporarily unavailable!
2013-01-04 00:54:38.757 [INFO] [175.143.153.228:53473-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock] on request #0, confirmed, 0, associated process: 7253, running: 1, error: Resource temporarily unavailable!
2013-01-04 00:54:38.757 [INFO] [175.143.153.228:53473-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.sock] on request #0, confirmed, 0, associated process: 7253, running: 1, error: Resource temporarily unavailable!
2013-01-04 00:54:38.758 [INFO] [175.143.153.228:53473-0#APVH_xxx.net] connection to [/tmp/lshttpd/lsphp5.s
RewriteBase /
RewriteRule (.*\.php)?$ – [E=Cache-Control:max-age=120]

Still same issue happen, There is any other idea?

Thanks
 
#20
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
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

RewriteRule /static/ajax.php - [L,E=Cache-Control:max-age=30]
RewriteRule ajax.php - [L,E=Cache-Control:max-age=30]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?do=/$1

</IfModule>
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 ?
To opt out your AdminCP
/home/your_username/public_html/your_admincp/
working url : http://www.xxx.com/admincp

To opt out User profiles (pics, cover photos)
/home/your_username/public_html/user/profile/
working url : http://www.xxx.com/user/profile

To opt out Designer
/home/your_username/public_html/core/index-member/customize/
working url : http://www.xxx.com/core/index-member/customize
If, my current is wrong, please let me know. so we can simply it.

Glad to hear from you

Thanks.
 
Top