I use gzip module of nginx to compress documents. When gzip is enabled nginx will automatically send content-ending of gzip with HTTP headers, right?
Without adding any PHP header header()
or HTML meta http-equiv
, this works perfectly. However, I have seen on online tutorial for adding header for gzip whether by PHP or HTML meta to assist browser to process gzipped data.
Is it really needed? Since I was not sure if this is needed on some conduction (that I am not testing), I asked this question for further clarification of the issue.
Nginx compresses data on mime type. For static files it uses the mime.types file for this but for data from a backend you do need to set the mime type unless the default is already text/html or you've added the default to the types of be compressed. See http://wiki.nginx.org/HttpGzipModule#gzip_types