Using Gzip/Brotli Compression

How Can We Help?
< Back
You are here:
Print

The Master Switch

OpenLiteSpeed’s default Gzip and Brotli Compression settings should be appropriate for most situations. The server level Enable Compression setting is a master switch, and is enabled by default. If you set it to No, it will disable compression server-wide, overriding all virtual-host-level compression settings.

Server-Level Compression Configuration

compression

  • Compressible Types is a comma-separated list of MIME types that may be compressed. You may use wildcards for MIME types, for example, */*, or text/*. You can put ! in front of a MIME type to exclude it. The order of the list is important if you use !. A list like text/*, !text/css, !text/js will compress all text files except for CSS and JS.  MIME type must be matched before compression is considered. It controls both static and dynamic content and mod_gzip.
  • Dynamic GZIP compression control will be effective only if GZIP Compression is enabled.
  • GZIP Compression level ranges from 1 (Minimum) to 9 (Maximum).
  • If you set the Brotli Compression Level (Static File) to 0, then Brotli is disabled at the server level.
  • Use Min Static File Size to specify the smallest size static file for which the server will create a corresponding compressed file. Any files that fall below the threshold will not be compressed by the server during initial access. However, they will still be compressed dynamically via mod_gzip. Static files are compressed only once, so even the smallest of files would be better off generated once at initial access than dynamically generated at runtime via mod_gzip.

Virtual Host level Compression Configuration

ols compression

You can control gzip compression and brotli compression separately at the virtual host level.