gzip not working on nginx
conf
gzip on;
gzip_vary on;
gzip_min_length 100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/javascript
application/json
application/javascript;
Make Sure Gzip module installed with nginx
2>&1 nginx -V | tr -- - '\n' | grep _module | grep gzip
Output Should be : http_gzip_static_module
Configuration
Host Configuration file under server block.
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml/javascript;
service nginx reload
Testing
curl -H "Accept-Encoding: gzip" -I https://example.com/
Have you tried to add 'gzip_comp_level level;
'? It looks like you missed something in your configuration. Here you have a working example:
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;