nginx compression-at-edge (in front of a reverse proxy) compresses some content, not other ?

Igor Sysoev igor at sysoev.ru
Wed Apr 28 10:32:52 MSD 2010


On Tue, Apr 27, 2010 at 09:12:13PM -0400, BenDJ wrote:

> I've an nginx + varnish + apache2 stack.  Nginz server as redirector, ssl handshake, and gzip compression.  Varnish serves as a reverse-proxy, and apache 'just' hosts apps & serves content.
> 
> I'm trying to get gzip compression behaving properly.  I'm getting intermittent results -- some content seems to be gzipped, some not.
> 
> I'm looking for some help figuring out WHERE the problem lies, and what to do to fix it.
> 
> In nginx conf, I've,
> 
> 	[code]
> ...
> 	http {
> 		...
> 		gzip              on;
> 		gzip_http_version 1.0;
> 		gzip_comp_level   9;
> 		gzip_proxied      any;
> 		gzip_buffers      16 8k;
> 		gzip_min_length   0;
> 		gzip_types text/plain text/css text/xml text/javascript application/x-javascript;
> 		gzip_disable "MSIE [1-6].(?!.*SV1)";
> 		gzip_vary         on;

BTW, in 0.7.12+ you may use
    gzip_disable  msie6;
instead of
    gzip_disable "MSIE [1-6].(?!.*SV1)";
It's faster.

Also, "gzip_comp_level 1" is enough. 9th level simply eats more CPU, but
do not produce proportional cmpression ratio. Say, 1 decreases file 2 times
while 9 - only 2.5, but not 5 times.


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list