Welcome! Log In Create A New Profile


Compressed page streams detection and optimization

September 12, 2013 06:07AM

I have a website serving a number of different PHP based applications.
Some of them natively serve their own gzipped pages, others only serve compressed HTML but uncompressed .css and .js files, others don't compress anything.

So far I have a per /location/ Nginx gzip configuration. Gzip is globally disabled and is explicitly enabled per location.
The apps I need or want to be compressed by Nginx simply have this:

location /blah/ {
include my_gzip_custom.conf

That conf file works great for all but one web app that serves a weird mix of compressed and uncompressed pages / related files.
What happens if Nginx gets served by PHP-FPM a compressed page and maybe 1 compressed .css file + 5 uncompressed .css files and 6 .js?
Does it "spend time and resources" re-compressing the already compressed streams?
Does it wrap the gzipped compressed streams inside its own compressed streams? (I admit my ignorance about if nested compressed streams are even supported by web standards).

Or does it - hopefully - detect an incoming stream "magic numbers" or headers and transparently skips re-compression / wrapping?
That is, may I get an efficient output where Nginx only compresses the specific page-included files (.css etc) that required it and passes-through the already compressed contents?

If not, is it possible to implement such a mechanism by means of configuration and how?

Thanks in advance.
Subject Author Posted

Compressed page streams detection and optimization

dfumagalli September 12, 2013 06:07AM

Re: Compressed page streams detection and optimization

Maxim Dounin September 12, 2013 07:56AM

Re: Compressed page streams detection and optimization

dfumagalli September 12, 2013 10:35AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 309
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready