banner
moeyy

moeyy

一条有远大理想的咸鱼。
github
mastodon
email

BT panel LNMP enables Brotli compression, which can improve website loading speed.

Note: Brotli is an open-source compression algorithm introduced by Google. It uses a variant of the LZ77 algorithm, Huffman coding, and second-order text modeling to compress data. Compared to other compression algorithms, it has higher compression efficiency and better performance. It can efficiently compress various types of files and scripts in web pages, thereby improving loading speed and enhancing the browsing experience. The author has currently enabled Brotli compression, and the experience is good. Here, I will explain how to enable it in the Baota Panel.

Installation#

1. Download Brotli

2. Compile Nginx

First, check the current version information of Nginx using the command:

It will output something like:

The nginx version is 1.15.10, and the configure arguments: section contains the compilation parameters for your nginx, which will be used later.

Next, download nginx again and start the compilation process using the following commands:

If everything goes well, the compilation should be completed. Then, use the following command to check the information:

image

If there is a --add-module=/www/server/ngx_brotli in the returned parameters, the compilation is successful.

In addition to manual compilation, there is a more convenient and low-error-rate method: using the Baota Panel's built-in Nginx installation script for compilation and installation. The general steps are as follows:

3. Enable Brotli Compression
Next, click on the "Software Store" on the left side of the panel, go to "Nginx Settings", and modify the configuration. Add the following content within the http section to enable Brotli compression.

Finally, click on "Reload Configuration" in the "Nginx Settings" to apply the changes.

Explanation of all Brotli parameters:

image

Once everything is configured, you can use Google Chrome to check if it is enabled. If you see the br field, it means it is successful.

In conclusion, the author feels that the compression effect is good. If you are interested, you can give it a try. The installation methods for other environments are similar. Here, it is assumed that Brotli and Gzip coexist and are both enabled. The advantage is that when some older browsers do not support Brotli, it will automatically switch to Gzip compression.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.