From 2fffc382a47069db0293801b9b7d5d78cb30b75e Mon Sep 17 00:00:00 2001 From: Russell Clare Date: Tue, 31 Jan 2017 06:40:11 +0800 Subject: [PATCH 1/2] Adding in ability to disable server_tokens, defaulting to on (previous behaviour) --- defaults/main.yml | 2 ++ templates/nginx.conf.j2 | 1 + 2 files changed, 3 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index f5b602a..de9a57d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,6 +26,8 @@ nginx_tcp_nodelay: "on" nginx_keepalive_timeout: "65" nginx_keepalive_requests: "100" +nginx_server_tokens: "on" + nginx_client_max_body_size: "64m" nginx_server_names_hash_bucket_size: "64" diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index cedfd72..f99f832 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -35,6 +35,7 @@ http { keepalive_timeout {{ nginx_keepalive_timeout }}; keepalive_requests {{ nginx_keepalive_requests }}; + server_tokens {{ nginx_server_tokens }}; #gzip on; {% if nginx_proxy_cache_path %} From dc2723a753928f78cd9c4a282868e64091cb9060 Mon Sep 17 00:00:00 2001 From: Russell Clare Date: Tue, 31 Jan 2017 06:49:15 +0800 Subject: [PATCH 2/2] Updating readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index ff8707b..3e82505 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ TCP connection options. See [this blog post](https://t37.net/nginx-optimization- Nginx keepalive settings. Timeout should be set higher (10s+) if you have more polling-style traffic (AJAX-powered sites especially), or lower (<10s) if you have a site where most users visit a few pages and don't send any further requests. + nginx_server_tokens: "on" + +Nginx server_tokens settings, this controlls if nginx responds with it's version in the HTTP headers, set to off to disable + nginx_client_max_body_size: "64m" 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.