Brotli (original) (raw)

  1. Home
  2. F5 NGINX Plus
  3. Admin Guide
  4. Dynamic Modules Brotli

Brotli is a general‑purpose, lossless data compression algorithm that uses a variant of the LZ77 algorithm, Huffman coding, and second‑order context modeling. Its compression ratio is comparable to the best currently available general‑purpose compression methods. Its speed is similar to DEFLATE but with denser compression.

The ngx_brotli module enables Brotli compression in F5 NGINX Plus and consists of two modules:

  1. Check the Technical Specifications page to verify that the module is supported by your operating system.
  2. If required, install the epel-release dependency
    • for Amazon Linux 2 LTS:
sudo amazon-linux-extras install epel -y  
sudo amazon-linux-extras install epel -y  
sudo yum update && \  
sudo yum install epel-release -y  
sudo yum update && \  
sudo yum install epel-release -y  

Install the Brotli module package nginx-plus-module-brotli.

sudo yum update && \  
sudo yum install nginx-plus-module-brotli  
sudo yum update && \  
sudo yum install nginx-plus-module-brotli  
sudo dnf update && \  
sudo dnf install nginx-plus-module-brotli  
sudo dnf update && \  
sudo dnf install nginx-plus-module-brotli  
sudo apt update && \  
sudo apt install nginx-plus-module-brotli  
sudo apt update && \  
sudo apt install nginx-plus-module-brotli  
sudo zypper refresh && \  
sudo zypper install nginx-plus-module-brotli  
sudo zypper refresh && \  
sudo zypper install nginx-plus-module-brotli  
sudo pkg update && \  
sudo pkg install nginx-plus-module-brotli  
sudo pkg update && \  
sudo pkg install nginx-plus-module-brotli  

After installation you will need to enable and configure Brotli modules in NGINX Plus configuration file nginx.conf.

  1. Enable dynamic loading of Brotli modules with the load_module directives specified in the top-level (“main”) context:
    nginx
load_module modules/ngx_http_brotli_filter_module.so; # for compressing responses on-the-fly  
load_module modules/ngx_http_brotli_static_module.so; # for serving pre-compressed files  
http {  
    #...  
}  
load_module modules/ngx_http_brotli_filter_module.so; # for compressing responses on-the-fly  
load_module modules/ngx_http_brotli_static_module.so; # for serving pre-compressed files  
http {  
    #...  
}  
  1. Enable Brotli compression and perform additional configuration as required by the ngx_brotli module. Brotli compression can be configured on the http, server or location levels:
    nginx
http {  
    server {  
        brotli on;  
        #...  
    }  
}  
http {  
    server {  
        brotli on;  
        #...  
    }  
}  
  1. Test the NGINX Plus configuration. In a terminal, type-in the command:
    Expected output of the command:
    shell
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  
nginx: configuration file /etc/nginx/nginx.conf is successful  
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  
nginx: configuration file /etc/nginx/nginx.conf is successful  
  1. Reload the NGINX Plus configuration to enable the module: