1. Choose to compile and install when installing nginx
  2. Fill in the parameters according to the screenshots and check the custom modules you need during installation.

--add-module=/www/server/ngx_brotli

mkdir -p /www/server/ngx_brotli
git clone https://github.com/google/ngx_brotli.git /www/server/ngx_brotli
cd /www/server/ngx_brotli && git submodule update --init

    aaPanel_Jose
    working. thanks.

    and add brotli config to nginx configuration

    brotli              on;
    brotli_static       on;
    brotli_comp_level   11;
    brotli_types text/plain text/css text/xml application/javascript image/x-icon image/svg+xml;
    2 months later

    @aaPanel_Jose
    can you have make a option while installing nginx have option to select modules and install and have a option under nignx app configuration option to disable and enable modules

    OMG is the best recomendation I Read ever "Not joking" like in PHP modules managment

    3 months later
    4 days later

    huaanhhuy

    Add this:

    brotli on;
    brotli_static on;
    brotli_comp_level 11;
    brotli_types text/plain text/css text/xml application/javascript image/x-icon image/svg+xml;

      3 months later

      aaPanel_Jose

      This no longer seems to work.

      adding module in /www/server/ngx_brotli
      ./configure: error: no /www/server/ngx_brotli/config was found
      make: *** No rule to make target 'build', needed by 'default'.  Stop.
      make: *** No rule to make target 'install'.  Stop.
      ========================================================
      Fedora release 34 (Thirty Four)
      Bit:64 Mem:959M Core:1 gcc:11.2.1 cmake:3.20.5
      Linux 5.13.7-200.fc34.x86_64 x86_64
      ERROR: nginx-1.21.0 installation failed.
      安装失败,请截图以上报错信息发帖至论坛www.bt.cn/bbs求助

        i gave a idea still not implemented.

          Turbine This no longer seems to work.

          It's true. It doesn't work. When you insert that module, Nginx fails to install.

          JAY i gave a idea still not implemented.

          This is the way to go

          2 months later

          can you make it automated still not yet done

          • JAY_ replied to this.
            2 years later

            Turbine
            I also encountered the same issue, however, when I checked, GIT was still not installed on my server. After installing it, it worked.

            3 months later

            deewinc
            I installed successfully with the script below:

            Module parameter:
            --add-module=/www/server/ngx_brotli

            Prefix script:

            mkdir -p /www/server/ngx_brotli
            git clone https://github.com/google/ngx_brotli.git /www/server/ngx_brotli
            cd /www/server/ngx_brotli && git submodule update --init
            cd /www/server/ngx_brotli/deps/brotli
            mkdir -p out && cd out
            cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
            cmake --build . --config Release --target brotlienc
            3 months later

            1- Hello, I executed the command that our friend said and it was installed. Is there any problem with this command?

            2- Do you think that nginx 1.24 needs pagespeed and ngx_brotli?
            mkdir -p /www/server/ngx_brotli

            git clone https://github.com/google/ngx_brotli.git /www/server/ngx_brotli
            cd /www/server/ngx_brotli && git submodule update --init
            cd /www/server/ngx_brotli/deps/brotli
            mkdir -p out && cd out
            cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
            cmake --build . --config Release --target brotlienc

            3- In the site configuration section and nginx configuration
            I enter brotli commands, it gives an error

            nginx: [emerg] unknown directive "brotli" in /www/server/nginx/conf/nginx.conf:69
            nginx: configuration file /www/server/nginx/conf/nginx.conf test failed

            7 months later
            Connect with us: 📨 Telegram 💬 Discord Email: support@aapanel.com