How to config Nginx 1.17 support Brotli Stream

This is a note shows how I config my Debian9 Nginx 1.17.0
server to support Brotli, Stream module

Config files

Download Brotli and stream module

// inside Oneinstack src folder
cd oneinstack/src
git clone
cd ngx_brotli
git submodule update --init

// option.conf
nginx_modules_options --add-module=/root/oneinstack/src/ngx_brotli --with-stream=dynamic
// nginx.conf
// Brotli
#Brotli Compression
  brotli on;
  brotli_comp_level 6;
  brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;

// Setup Gzip
#Gzip Compression
  gzip on;
  gzip_buffers 16 8k;
  gzip_comp_level 6;
  gzip_http_version 1.1;
  gzip_min_length 256;
  gzip_proxied any;
  gzip_vary on;
    text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
    text/javascript application/javascript application/x-javascript
    text/x-json application/json application/x-web-app-manifest+json
    text/css text/plain text/x-component
    font/opentype application/x-font-ttf application/
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";

Test your Brotli

curl -H 'Accept-Encoding: br' -I

// return content-encoding: br, means success
HTTP/2 200
server: nginx
date: Wed, 27 Feb 2019 19:24:53 GMT
content-type: text/html
vary: Accept-Encoding
content-encoding: br