Enable GZIP compression for Magento 2 Website on Apache/Linux to Make it Load Faster

What is GZIP ?

Gzip is a data compression algorithm capable of compressing and decompressing files quickly.

How can enabling GZIP can make a website load faster?

Websites are getting larger and carry a lot of content that can be compressed and save bandwidth during transmission over the networks. Compressing large text format files like javascript and css can save a lot of bandwidth thus improving loading speeds.

Using GZIP on a website

On Apache web server gzip compression is utilized to compress the outgoing traffic via mod_deflate. To use GZIP on a website mod_deflate must be installed, enabled and loaded with Apache.You can check of mod_deflate status by running below command in the linux terminal.>sudo httpd -M | grep deflateif mod_deflate is installed and enabled, you should see deflate_module (shared).