What is Gzip compression
Gzip is a file format and software application used in Unix systems to compress HTTP content before it is delivered to the client.
The process is known to compress a file by up to 80 percent, which improves page load time, and reduces bandwidth consumption.
The file types associated with gzip include:
- .gz – Specifies a file extension compressed by the gzip algorithm.
- tar file, tarball – A format used to store multiple files for archiving, but not for compression. and Gzip can be used to compress .tar files.
- .tgz, .tar.gz, .gz file – Specifies a .tar file compressed by gzip.
Run the Gzip command
Gzip can be applied on a number of different platforms, including those listed below:
You can run gzip in WordPress using a cache plugin that supports gzip, or by running gzip on your web server using a .htaccess file.
Enabling GZIP on the Apache server
To enable gzip on an Apache web server, add the gzip compression commands within
The module is at the end of the .htaccess file.
Enabling GZIP on an NGINX server
To enable gzip in NGINX, add the following code to the Nginx.conf file:
Gzip Activation Verification
After running gzip, the next step is to make sure it compresses the outgoing files from your site. This is done by checking HTTP requests in the browser.
For example, by logging in to the Network in the Headers tab, from there you should get to the Content-Encoding header.
In response, gzip should appear in the Headers in the expression Content-Encoding:
HTTP/1.1 200 OK Server: nginx Date: Mon, 21 Jul 2014 01:12:36 GMT Content-Type: text/html; charset=UTF-8… Vary: Accept-Encoding Content-Encoding: gzip
Using Gzip compression in conjunction with CDN
Now we know What is Gzip compression, I explain how to conjunction Gzip and CDN.
Almost all content transfer networks (CDNs) provide automatic file compression with gzip. This alleviates the need to verify that compression does take place.
Besides, CDNs support many site-speed optimization techniques. That can used in conjunction with gzip to further reduce the output file size.
These include minimization, an optimization process in which components. Such as white spaces and recurring variable names cut from the source file code. Which can reduce the file size by half before compression.
Although minify compression may seem redundant, it has been shown to reduce the junk file size by an additional 5-10%.
Because CDN performs both minify and gzip compression, they minimize the size of the code files transmitted to your users, significantly reducing page load time.