FeaturesWP CloudPricingEE CLIContactMy Account

Features

Team Access & User Permissions

Server Setup & Management

Site Creation & Management

Deployments & Developer Tools

Firewall Protection

Speed & Caching

Backups & Recovery

Logs & Monitoring

Create WP Cloud Sites

All Features

Read Documentation

Install

Installation Guide

FAQ

Roadmap

Explore EE CLI

Resources

Commands

Handbook

Blog

Community

Forum

EasyExperts

Tutorials

Subscribe

Github

CLEAR

Start For Free

separator Tutorials separator Nginx separator Enable gzip compression

Topics

On this page

Enable Gzip Compression

Enable gzip compression

You can use a site like gtmetrix.com to check if your site has gzip compression enabled properly.

You can use these tools:

check for gzip compression on HTML output of pages.

You can enable gzip compression for CSS and JavaScript files also. Apart from that any text data, e.g. XML files will also benefit from gzip compression. However, never turn on gzip compression on images or any kind of binary data.

Enable Gzip Compression

Most likely gzip is enabled on your server. If not, you can following codes in /etc/nginx/nginx.conf


			gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
		

Most important lines are gzip on and gzip_types

gzip on turns on gzip compression. Later on, you can add gzip off under a server{..} block or location{..} to turn off gzip compression for one or more sites/regions.

gzip_typesis list of MIME-types for which you want to turn on compression. text/html is implied and cannot be turned off (unless you set gzip off). text/css and application/x-javascript enables gzip compression for CSS and javascript files respectively.

Reference: gzip documentation

Configuring HTTP/2 Server Push

PREVIOUS

fail2ban

NEXT


Comments

Features

Useful Links

Product

Other Products

Subscribe for curated product updates, tips, and announcements.

"*" indicates required fields

Facebook

This field is for validation purposes and should be left unchanged.

Email*

SIGN ME UP

Δ


© rtCamp, since 2009. All rights reserved.

Powered by