GZIP compression of a WWW-domain

From ISPWiki
Jump to: navigation, search

The ngx_http_gzip_module module is a filter that compresses a request with gzip, enabling to reduce data size.

Configuration

   server {
           gzip            on;
           gzip_disable    "msie6";
           gzip_types      text/plain application/xml;
           gzip_comp_level  5;
        }

Directives (you can see a default value next to the directory):

gzip on

Enable gzip compression.

gzip_disable "msie6";

Disable gzip compression for requests with “User-Agent” heading fields that match specified regular expressions.

The “msie6” special mask corresponds to the “MSIE [4-6]\.” regular expression, but it is faster.

gzip_types "text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript"

Enable gzip compression for specified MIME-types in addition to “text/html”. “text/html” requests will be always compressed.

To modify a list of MIME-types, you need:

In ISPmanager Lite:

create a path variable named nginx-gzip-types and enter required MIME-types in the /usr/local/mgr5/etc/ispmgr.conf configuration file

In ISPmanager Business

in the /usr/local/mgr5/etc/ispmgrnode.conf file for every WWW-node. Example:

    path nginx-gzip-types text/plain text/css

If compression has been already configured for a domain, restart the panel and edit the WWW-domain to apply the changes in gzip_types.

gzip_comp_level 1-9;

This will set the level of gzip compression. Possible values are 1-9.

To enable GZIP compression: in the WWW-domain edit form select the "Enable compression" check box, choose a compression level, and save the form.