How to Enable GZIP Compression in WordPress website Hosted on NGINX Server

How to Enable GZIP Compression in WordPress website Hosted on NGINX Server

How to Enable GZIP Compression in WordPress website Hosted on NGINX Server-: In My Previous Post I Have explained how to enable Gzip compression on a WordPress website hosted on Apache Server. In this post, I will explain photo enable Gzip compression a WordPress website hosted on NGINX server.

What is GZIP Compression-:

Gzip is a data compression algorithm capable of compressing and decompressing files quickly. The name also refers to two other technologies: the software used to compress and decompress files, and the format those files are stored in. Gzip can compress almost any file type, from plain text to images, and is fast enough to compress and decompress data on-the-fly.

Gzip is a method of compressing files (making them smaller) for faster network transfers. It is also a file format. Compression allows your webserver to provide smaller file sizes which load faster for your website users. Enabling gzip compression is standard practice.

There are two ways to compress web content: dynamically and statically. Dynamic compression compresses files when they’re requested by the user, and is the default approach used by most web servers. Dynamic compression is useful for content that changes frequently, such as application-generated web pages.

On the other hand, static compression compresses each file in advance and delivers this pre-compressed version when the original file is requested. Files that don’t change frequently—such as JavaScript, CSS, fonts, and images—benefit the most from static compression since they only need to be compressed once. This saves CPU time at the cost of a slightly longer deployment.

How to Enable GZIP Compression in WordPress site Hosted on NGINX Server-:

NGINX is open-source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers.

While most shared hosting plans come with Apache web servers, you may be using something else, such as NGINX or Microsoft’s IIS. Enabling GZIP compression for NGINX web servers is slightly different from modifying the .htaccess file available to you if you were running on an Apache webserver. If you’re running on NGINX (like Kinsta), you can enable GZIP compression in WordPress by looking for your nginx.conf file and adding the following code:

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;

Thanks for reading…“Pardon my grammar, English is not my native tongue.”

If you like my work, Please Share on Social Media! You can Follow WP knol on Facebook, Twitter, Pinterest and YouTube for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.

About Amar Patel 263 Articles
Hi, I am Amar Patel from India. Founder, Author and Administrator of wpknol.com. I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.