2.7.5. gzip and brotli compression
Compression is performed by means of the nginx server and is enabled by default for all sites located on shared hosting. Files are compressed in size at least 2 KB... Smaller files are not compressed as this is inefficient.
The compression algorithm is selected depending on the protocol used and the availability of client-side support:
- Brotli — used under the following conditions:
- The algorithm is supported on the client side — the browser passes the header
Accept-Encodingwith directive br.
- The connection is made by HTTPS — browsers deliberately do not allow brotli to be used over HTTP due to the risk of data corruption by proxy servers.
- Gzip — used in other cases.
Configure compression through the Apache server using
mod_deflate and directives in .htaccess Not recommendedas this can lead to an increase in the load on the web server and will not give an increase in the speed of loading the site. If, nevertheless, there is a need for such a setting, then when adding compression directives to .htaccess remove the extensions of the compressed files from list of static files.