Compression doesn't seem to work...

#1
Hi there!

I was checking out my Rails site with a free online site speed testing tool. It said that compression was not enabled for the site. I checked in the settings and sure enough compression was set to 'yes'. So I tried changing the MIME type to "text/*" ... no dice.

I'm not sure what else to try. I'm using Easy Rails and I added rewrite rules to handle the caching. I don't have rules to redirect to dispatch.lsapi, but my site is working fine without it. I don't even know if that has anything to do with it.

Why isn't the page compressed when it's delivered from the cache?
 

mistwang

LiteSpeed Staff
#2
You need to give the user that LSWS run as write permission to the cache directory.
LSWS will create compressed version under the same directory where the original file is.
 
#3
Ok, that worked. This is what I did... (for posterity and so you can chastise me if I did it wrong) :)

I edited /etc/groups and added 'nobody' to the group that owns the public dir.
Then I changed all the directories in public to 775 with this...

chmod 775 public
find ./public -type d -exec chmod 775 {} \;

Then I restarted LSWS and voila! compression!
 

mistwang

LiteSpeed Staff
#4
What you did is correct. :)

If you want tighter security, you can run lsws as a dedicate user other than nobody, there are many services using nobody, then set mode to 0770 instead of 0775, to only allow access from LSWS user and directory owner.
 
#7
Free tools...

fantasydreaming: It may be a little late to respond to your question, but one of the ones I use is this one...

http://www.websiteoptimization.com/services/analyze/

I had another one that just tested compression that was great but I can't find it again using a quick search. The need to check isn't there anymore I guess. :)

And- checking the headers is one thing, but it's nice to see some verbose stats that interpret everything for you. :)
 
#8
Compresing javascript: does it work for you?

The service you linked to shows my main content as being compressed, but not the javascript files..

I understand that some really old browsers have trouble with it, but I have some really big files so it's nice to be able to compress them.

I have my litespeed settings 'compressable' types set to:
text/*, application/x-javascript

I installed the firefox live header and sent it to the address of my big javascript file, and the resulting header was:
HTTP/1.x 200 OK

Server: LiteSpeed

Date: Tue, 27 Mar 2007 12:51:08 GMT

Accept-Ranges: bytes

Cache-Control: max-age=604800

Expires: Tue, 03 Apr 2007 12:51:08 GMT

Etag: "35a07-46081c25-839229"

Last-Modified: Mon, 26 Mar 2007 19:16:53 GMT

Content-Type: application/x-javascript

Content-Length: 219655
 

xing

LiteSpeed Staff
#9
Make sure the directory that the script file resides is "writable" by litespeed user. This is a requirement for litespeed to compress static content as it writes/caches the compressed file as a ".lsz" file in that directory.
 
#10
Compressing Javascript

Compressing javascript worked for me, but I'm thinking of turning it off because some browsers don't support javascript compression very well. I haven't seen any problems directly with my own eyes but it's reported to be the case. As far as I remember, part of the problem is that caching doesn't work on IE browsers properly for .js and .css files that are compressed, so they end up getting reloaded every time from the server.

You might want to read up on it to see if you really want to compress javascript. :)
 
Top