How to Enable Gzip Compression On Your Web Server

What is Gzip Compression?

Si Thu Phyo
Newbiesbox
2 min readJun 21, 2016

--

Gzip is a file format and is a method of compressing files to make faster network transfer. Gzip performs best on text-based content and can compress 50%~80% for larger files. Enabling Gzip compression makes your website performance better and save the network bandwidth. In this article, I will show you how to enable Gzip compression on your web server.

Enable Gzip Compression on Apache Web Server

Copy and paste the following code in your .htaccess file and save. Your .htacess file locates in the root of domain.

Enable Gzip Compression on Nginx Web Server

If you are running web server with Nginx, edit your nginx.conf file. Copy and paste the following code.

After enabling Gzip compression configuration on your web server, test with Gzip compression tools. The following picture is my website’s Gzip compression status report.

gzip-compression

According to the report, Gzip is enabled on newbiesbox.com and compression ratio is 86.37% of original size. If you are trying to make better performance for your website, you should make not only Gzip compression but also leverage browser caching. Cheers… :D

--

--

Si Thu Phyo
Newbiesbox

I’m a WordPress developer and trainer of Web Development Class at Myanmar Tech Wave. Founder of newbiesbox.com and love in writing and playing Kyokushin karate.