add gzip support and doc about it

pull/69/head
ahivert 8 years ago
parent 23866e4b31
commit e088abb6db
  1. 13
      README.md
  2. 10
      defaults/main.yml
  3. 13
      templates/nginx.conf.j2

@ -82,6 +82,19 @@ Nginx keepalive settings. Timeout should be set higher (10s+) if you have more p
This value determines the largest file upload possible, as uploads are passed through Nginx before hitting a backend like `php-fpm`. If you get an error like `client intended to send too large body`, it means this value is set too low.
nginx_gzip: "on"
nginx_gzip_disable: "msie6"
nginx_gzip_vary: "on"
nginx_gzip_proxied: "any"
nginx_gzip_comp_level: "6"
nginx_gzip_buffers: "16 8k"
nginx_gzip_http_version: "1.1"
nginx_gzip_min_length: "256"
nginx_gzip_types: "text/html"
Improve time loading with Gzip compression. Enabled by default, you might need to change `nginx_gzip_types` to add more [type](https://www.nginx.com/resources/wiki/start/topics/examples/full/#mime-types) to compress files like .js, .css, .png... All details options available [here](http://nginx.org/en/docs/http/ngx_http_gzip_module.html)
nginx_server_names_hash_bucket_size: "64"
If you have many server names, or have very long server names, you might get an Nginx error on startup requiring this value to be increased.

@ -16,6 +16,16 @@ nginx_multi_accept: "off"
nginx_error_log: "/var/log/nginx/error.log warn"
nginx_access_log: "/var/log/nginx/access.log main buffer=16k"
nginx_gzip: "on"
nginx_gzip_disable: "msie6"
nginx_gzip_vary: "on"
nginx_gzip_proxied: "any"
nginx_gzip_comp_level: "6"
nginx_gzip_buffers: "16 8k"
nginx_gzip_http_version: "1.1"
nginx_gzip_min_length: "256"
nginx_gzip_types: "text/html"
nginx_sendfile: "on"
nginx_tcp_nopush: "on"
nginx_tcp_nodelay: "on"

@ -35,7 +35,18 @@ http {
keepalive_timeout {{ nginx_keepalive_timeout }};
keepalive_requests {{ nginx_keepalive_requests }};
#gzip on;
gzip {{ nginx_gzip }};
{% if nginx_gzip == "on" %}
gzip_disable "{{ nginx_gzip_disable }}";
gzip_vary {{ nginx_gzip_vary }};
gzip_proxied {{ nginx_gzip_proxied }};
gzip_comp_level {{ nginx_gzip_comp_level }};
gzip_buffers {{ nginx_gzip_buffers }};
gzip_http_version {{ nginx_gzip_http_version }};
gzip_min_length {{ nginx_gzip_min_length }};
gzip_types {{ nginx_gzip_types }};
{% endif %}
{% if nginx_proxy_cache_path %}
proxy_cache_path {{ nginx_proxy_cache_path }};