Richy
Richy

Reputation: 117

Nginx and compressing components with gzip

I'm trying to improve page speed on a site and using "Yslow" and "Page Speed" to monitor the speeds. I am being told by both to "compress components with gzip" and given a listing of a number of CSS and JavaScript files, for example

Our hosting have informed us that nginx is doing the gzip compression on ALL assets, even if it reverse proxies back to Apache and the folllowing values from the nginx site-enable files, which is enabled at a virtual host level, confirms this:

gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 9;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml   application/xml+rss text/javascript;

Is there a reason these tools are not picking up by the compression or is it in fact they are not being compressed at all and we need to get our hosting to add something extra?

Upvotes: 1

Views: 3610

Answers (1)

cobaco
cobaco

Reputation: 10546

your hosting provider claims that the requests leave nginx compressed that leaves as potential problem causes:

  1. there's a proxy/cache/virusscanner somewhere on the network path between the nginx server and your client that strips out the compression.
  2. your browser saves an uncompressed version of the asset, and yslow/pagespeed ends up using that (if so make sure you trying it with an empty browser-cache should fix it)
  3. you're hosting provider's claim is false (but the posted config bit seems ok to me )

the problem could be a proxy or cache inbetween the nginx server and your browser that strips out the compression.

Some things to try:

Upvotes: 3

Related Questions