Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx enable Brotli algorithm compression example

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you an example of Nginx enabling Brotli algorithm compression, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Installation module

To enable the ngx_brotli module, you need to add the appropriate module when compiling the Nginx:

# get source

Git clone https://github.com/google/ngx_brotli.git

Cd ngx_brotli

Git submodule update-init

Cd..

# configure

. / configure...-- add-module=../ngx_brotli

Configuration file

After installing the ngx_brotli module, you can enable it in the configuration file:

# configuration segment: http, server, location

# enable ngx_brotli compression

Brotli on

# specifies the minimum length of compressed data, which will be compressed only if it is greater than or equal to the minimum length. 20 bytes are specified here

Brotli_min_length 20

# number and size of Brotli request buffers

Brotli_buffers 16 10k

# window value used by Brotli. Default value is 512k

Brotli_window 512k

The # compression level can be 0 to 11, and the default value is 6. A high level of compression is not very good for performance improvement because it requires more CPU time

Brotli_comp_level 6

# specify the types of replies that are allowed to be compressed

Brotli_types text/html text/xml text/plain application/json text/css image/svg application/font-woff application/vnd.ms-fontobject application/vnd.apple.mpegurl application/javascript image/x-icon image/jpeg image/gif image/png

# whether to find preprocessed compressed files ending in .br. Available values are on, off, always

Brotli_static always

The above is an example of Nginx enabling Brotli algorithm compression. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report