Posted by sirkitree on April 3, 2012 at 11:29pm
It used to be that gzip compression setting were found within the nginx.conf file, such as:
gzip on;
gzip_comp_level 1;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;However, looking over the latest within the nginx-for-drupal repo it's simply turned on by default.
Is this because it should be up to individual site configs (sites-available) to implement the other settings?
If so, what setting do you recommend, and why?

Comments
However, looking over the
By default (with gzip on) you will have gzip_comp_level => 5 and gzip_types => text/html only
All the rest is done in the Aegir server template (in Provision)
See: https://github.com/omega8cc/provision/blob/master/http/Provision/Config/...
The reason why we didn't move also that one line to the server template in Aegir is to stay backward compatible without the need to edit default nginx config created with
apt-get install nginx, to avoid duplicate directives and breaking the config.BTW:
text/htmlshouldn't be listed there, as it is included by default and adding it there may cause duplicate directive warning.Thanks for the comments and
Thanks for the comments and the reasoning!
So let's say I already have the gzip on, and things like css and js are not being compressed. Is it just a matter of adding the
gzip_types text/css application/x-javascript text/javascript;to my config?
Yes, exactly
By default only
text/htmlis compressed: http://wiki.nginx.org/HttpGzipModule#gzip_typesHrm
Adding these in doesn't seem to help, even after removing the nginx cache entry, restarting nginx and php5-fpm - any hints on what else I should look at here? Relevant pieces?
No header
Content Encoding: gzipwhen you do acurl -I myfile.cssormyotherfile.js?Notta :(
HTTP/1.1 200 OKServer: nginx/1.0.14
Date: Wed, 04 Apr 2012 16:27:05 GMT
Content-Type: application/x-javascript
Content-Length: 15624
Last-Modified: Tue, 28 Feb 2012 15:30:24 GMT
Connection: keep-alive
Accept-Ranges: bytes
HTTP/1.1 200 OKServer: nginx/1.0.14
Date: Wed, 04 Apr 2012 16:28:24 GMT
Content-Type: text/css
Content-Length: 8852
Last-Modified: Tue, 28 Feb 2012 15:30:24 GMT
Connection: keep-alive
Accept-Ranges: bytes
curl -I -H 'Accept-Encoding:
curl -I -H 'Accept-Encoding: gzip,deflate' http://www.mysite.comLooks like text/html is
Looks like text/html is success from that:
HTTP/1.1 200 OKServer: nginx/1.0.14
Date: Wed, 04 Apr 2012 17:00:30 GMT
Content-Type: text/html
Last-Modified: Tue, 28 Feb 2012 15:37:02 GMT
Connection: keep-alive
Content-Encoding: gzip
css & js with that
CSS
HTTP/1.1 200 OKServer: nginx/1.0.14
Date: Wed, 04 Apr 2012 17:02:03 GMT
Content-Type: text/css
Last-Modified: Tue, 28 Feb 2012 15:30:24 GMT
Connection: keep-alive
Content-Encoding: gzip
JS
HTTP/1.1 200 OKServer: nginx/1.0.14
Date: Wed, 04 Apr 2012 17:02:32 GMT
Content-Type: application/x-javascript
Last-Modified: Tue, 28 Feb 2012 15:30:24 GMT
Connection: keep-alive
Content-Encoding: gzip
When I run it through Google's Page Speed app it says they're not compressed though. Perhaps that tool is stale. (/me looks for another tool)
yeah
looks like google had my results cached as other sites on the same server are now working.
Thanks for all the fish! :)