jdauphant/ansible-role-nginx

Enabling gzip compression doesn't seem to work

Closed this issue · 1 comments

chiel commented

First off, thanks for the nice role - it works a charm with very minimal configuration.

When I started looking more closely at my server responses in chrome's developer tools, I noticed that gzip compression was not enabled. I looked at the readme and it seemed basic enough, so I added the following to my playbook:

    - role: jdauphant.nginx
      nginx_configs:
        gzip:
          - gzip on
          - gzip_disable msie6

Which, sure enough, indeed added a file to /etc/nginx/conf.d/gzip.conf with the following contents:

$ cat /etc/nginx/conf.d/gzip.conf
#Ansible managed: /Users/chiel/dev/ansible/roles/jdauphant.nginx/templates/config.conf.j2 modified on 2016-06-18 11:57:02 by chiel on chiel-mbp.local

gzip on;
gzip_disable msie6;

However, when I inspect the network tab there is still no gzip header and the content is exactly the same size as before. Am I missing something?

Thanks

chiel commented

Right, figured it out - the issue was simply that I didn't specify gzip_types. Sorry for the issue.