Gzip compression not working

Hello,
I have a fresh new installation of nginx on ubuntu 8.04 (installed via
apt-get, I believe it is 0.5.x something)

In my nginx.conf file I have gzip turned on, now I wanted to do a basic
test
and serving a static html file, but the file does not come compressed at
all.

Here’s the snippet of configuration, I tried variations on this without
success

gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types text/plain text/html text/css
application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
gzip_http_version 1.1;
gzip_comp_level 6;

Does anyone have any idea why nothing is compressed?

I’ve used this GIDZipTest: Web Page Compression (Deflate / Gzip) Test - GIDNetwork and others
to
test the results.

Thank you so much!

Christian,

Is the test file you are testing larger than 1100 bytes and one of the
formates you listed in gzip_types?

If you have curl (linux, BSD, ect.) installed you can do your own
header tests with: curl -I --compressed http://localhost

Nginx “how to”
Nginx Secure SSL Web Server @ Calomel.org


Calomel @ https://calomel.org
Open Source Research and Reference

On Wed, May 21, 2008 at 12:24:39AM -0500, Christian B. wrote:

I’ve used this GIDZipTest: Web Page Compression (Deflate / Gzip) Test - GIDNetwork and others to
test the results.

www.gidnetwork.com send HTTP/1.0 request, which is not gzipped because
of “gzip_http_version 1.1”.

Also, you do not need to set gzip_types, those never be issued by nginx:

application/xml, application/xml+rss, text/javascript.

It’s CPU cycles waste.

On Wed, May 21, 2008 at 01:00:53PM -0400, Calomel wrote:

Igor,

Why do you not need to specify “gzip_types”? Is it because he is using
“gzip_proxied any;” ?

No. The gzip modules tests Content-Type sequentially, so the shorter
list is the better. The “application/xml, application/xml+rss,
text/javascript”
are not defined in nginx’s mime.types. However, they may be set by a
backend.

Igor,

Why do you not need to specify “gzip_types”? Is it because he is using
“gzip_proxied any;” ?


Calomel @ https://calomel.org
Open Source Research and Reference

Hi guys, ok just removing the file size did work…and the http test as
well. Now should I be concerned with gzip_http at all? what is going to
give me compression for most clients out there?
Thanks for the tip on the types as well.

Christian

On Wed, May 21, 2008 at 11:24 AM, Calomel [email protected] wrote:

test and serving a static html file, but the file does not come
text/javascript;
Visible links

  1. GIDZipTest: Web Page Compression (Deflate / Gzip) Test - GIDNetwork

Christian B.
Director of IT
Warmlyyours.com, inc.

Phone: (800) 875-5285 ext.800
Fax: (847) 550-2600
Email: [email protected]

WarmlyYours
Honeywell authorized licensee
2 Corporate Dr., Suite 100
Long Grove, Illinois 60047

Visit the WarmlyYours website at: www.warmlyyours.com

24/7 Installation Support • Lifetime Technical Assistance • Free Design
Service
This email and any files transmitted with it are confidential and
intended
solely for the use of the individual or entity to whom they are
addressed.
If you have received this email in error please notify the system
manager.
Please note that any views or opinions presented in this email are
solely
those of the author and do not necessarily represent those of the
company.

This is my revised setting, I had to set proxy_set_header for it to
compress, not sure what it does or why.

As for the gzip types, shouldn’t text/javascript be compressed? should
we
add it to the mime types?

Thank you

gzip  on;
gzip_buffers     4 8k;
gzip_proxied     any;
gzip_types       text/plain text/html text/css 

application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 4;
gzip_http_version 1.0;
proxy_set_header Accept-Encoding “”;

On Thu, May 22, 2008 at 12:51 PM, Christian B.
[email protected]
wrote:

Christian,

test and serving a static html file, but the file does not come
application/x-javascript text/xml application/xml application/xml+rss

Director of IT

Visit the WarmlyYours website at: www.warmlyyours.com

24/7 Installation Support • Lifetime Technical Assistance • Free Design
Service
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
Please note that any views or opinions presented in this email are solely
those of the author and do not necessarily represent those of the company.

Christian B.
Director of IT
Warmlyyours.com, inc.

Phone: (800) 875-5285 ext.800
Fax: (847) 550-2600
Email: [email protected]

WarmlyYours
Honeywell authorized licensee
2 Corporate Dr., Suite 100
Long Grove, Illinois 60047

Visit the WarmlyYours website at: www.warmlyyours.com

24/7 Installation Support • Lifetime Technical Assistance • Free Design
Service
This email and any files transmitted with it are confidential and
intended
solely for the use of the individual or entity to whom they are
addressed.
If you have received this email in error please notify the system
manager.
Please note that any views or opinions presented in this email are
solely
those of the author and do not necessarily represent those of the
company.

On Thu, May 22, 2008 at 01:03:40PM -0500, Christian B. wrote:

This is my revised setting, I had to set proxy_set_header for it to
compress, not sure what it does or why.

proxy_set_header Accept-Encoding “”;

disables this header when request is proxied to backend.
However, any proxy_set_header in a locaiton resets proxy_set_header
inherited from previous level, therefore you should add it in these
locaitons instead of global level.

As for the gzip types, shouldn’t text/javascript be compressed? should we
add it to the mime types?

There are no text/javascript MIME-type. At least in Apache configuration
files.

i find a free online service to minify js
online-code.net - online code Resources and Information. and compress css
online-code.net - online code Resources and Information., so it will reduce the size
of web page.