Last Updated: September 09, 2019
·
3.202K
· falaa

How to check if nginx gzip module is working correctly

Nice way for debugging how compression works, based on Alexander Azarov link

http {
   gzip off;
   gzip_static on;
   log_format log_with_ratio "$remote_addr - $request - ($gzip_ratio)"; 

   server {
      access_log /var/log/nginx/file.log log_with_ratio;
   }
}

Follow logs with less on your server:

less /var/log/nginx/file.log

with / search your ip or path you are currently interested in, then press shift +f for follow mode.

and test url with curl:

curl -IL -H "accept-encoding: gzip" http://<some-url>