If you want to install Brotli that will update its modules when Nginx does use this guide, don’t forget to chmod +x the files you create or when there is an update Nginx will not work.
on this part I set the path directly into /etc/nginx/modules/
moddir=/path/to/modules/directory
Guide link below to create the script, apt hook and worker
https://www.majlovesreg.one/adding-brotli-to-a-built-nginx-instance