diff --git a/ansible/roles/nginx/files/nginx.conf b/ansible/roles/nginx/files/nginx.conf index 341fdbd..f366195 100644 --- a/ansible/roles/nginx/files/nginx.conf +++ b/ansible/roles/nginx/files/nginx.conf @@ -2,6 +2,7 @@ worker_processes auto; error_log /var/log/nginx/error.log; +load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so; load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so; pcre_jit on; @@ -37,6 +38,11 @@ http { gzip_comp_level 3; gzip_min_length 1024; + brotli on; + brotli_types *; + brotli_comp_level 7; + brotli_min_length 1024; + keepalive_timeout 65; include /etc/nginx/http.d/*.conf; diff --git a/ansible/roles/nginx/tasks/main.yml b/ansible/roles/nginx/tasks/main.yml index f44f7d0..571406e 100644 --- a/ansible/roles/nginx/tasks/main.yml +++ b/ansible/roles/nginx/tasks/main.yml @@ -22,6 +22,18 @@ when: ansible_os_family == 'Archlinux' become: true +- name: Install nginx-mod-brotli + package: + name: libnginx-mod-http-brotli-filter + when: ansible_os_family != 'Archlinux' + become: true + +- name: Install nginx-mod-brotli on Arch + kewlfft.aur.aur: + name: nginx-mainline-mod-brotli + when: ansible_os_family == 'Archlinux' + become: true + - name: Create config directories file: path: /etc/nginx/{{ item }}