Gzip compression are used for transferring data in compressed format to end users. This reduced website page load time and increases performance. If you are not sure that your site is running with gzip compression or not on Nginx server, Then you can use online gzip compression sites (Given at end of post) to confirm. If it’s already enabled with gzip you don’t need to do anything. But if gzip is not enabled, follow below steps.

Advertisement
  • Read: How to enable Gzip Compression on Apache Server
  • Enable Gzip in Nginx

    To enable gzip compression in Nginx server, Add the following content in Nginx main configuration file or create a separate gzip configuration file with following content.

    # vim /etc/nginx/conf.d/gzip.conf
    
    gzip on;
    gzip_min_length  100;
    gzip_buffers  8 32k;
    gzip_types  text/plain text/css application/x-javascript text/xml application/xml text/javascript;
    gzip_vary on;
    

    After adding above configuration just restart Nginx web server.

    # systemctl restart nginx
    

    Verify Gzip

    Now as your site has been enabled with gzip compression, let’s use one of below online tools to verify gzip is working correctly.

  • http://checkgzipcompression.com/
  • http://www.whatsmyip.org/http-compression-test/
  • Gzip Compression on Nginx

    Share.
    Leave A Reply


    Exit mobile version