Enable gzip compression

This commit is contained in:
phil 2023-03-11 20:52:04 +01:00
parent 5fdb1a9f7b
commit d3b3576815
4 changed files with 41 additions and 2 deletions

View file

@ -44,11 +44,28 @@ http {
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
{% if nginx_gzip is defined and nginx_gzip %}
gzip on;
{% if nginx_type == 'gateway' %}
gzip_proxied any;
{% endif %}
gzip_static on;
gzip_http_version {{ nginx_http_version }};
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
gzip_comp_level 6;
gzip_types
{% for type in nginx_gzip_types %}
{{ type }}
{% endfor %}
gzip_buffers 16 8k;
gzip_min_length 512;
{% else %}
gzip off;
{% endif %}
##
# Virtual Host Configs

View file

@ -1,6 +1,6 @@
# Managed by Ansible
proxy_http_version 1.1;
proxy_http_version {{ nginx_http_version }};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;