From 9dc6887ad9c6a97b2748fc28df7a1f522682fc2d Mon Sep 17 00:00:00 2001 From: Maga Abdurakhmanov Date: Tue, 27 Dec 2016 20:39:46 +0100 Subject: [PATCH 1/4] + allow to set log_format (switch order of log_file with http options --- templates/nginx.conf.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 88dd27b..1b88c3b 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -37,13 +37,13 @@ http { server_names_hash_bucket_size {{nginx_server_names_hash_bucket_size}}; - access_log {{nginx_access_log}}; - error_log {{nginx_error_log}}; - {% if nginx_http_options %}{% for option in nginx_http_options %} {{option}} {% endfor %}{% endif %} + access_log {{nginx_access_log}}; + error_log {{nginx_error_log}}; + {% if nginx_status %} server { listen {{ nginx_status }}; From b53ed267e6380f30df62982e81b90248d565d127 Mon Sep 17 00:00:00 2001 From: Maga Abdurakhmanov Date: Mon, 13 Feb 2017 13:14:52 +0100 Subject: [PATCH 2/4] + dynamic_modules support --- defaults/main.yml | 1 + templates/nginx.conf.j2 | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 27f1853..f5a4c7d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -47,3 +47,4 @@ nginx_yum_pkg: nginx nginx_yum_enablerepo: nginx nginx_yum_disablerepo: no nginx_apt_use_ppa_repo: yes # Use of nginx PPA repo +nginx_enable_dynamic_modules: no # Enable dynamic modules like geo diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 1b88c3b..ee98c72 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -1,6 +1,10 @@ # This file was generated by Ansible for {{ ansible_fqdn }} # Do NOT modify this file by hand! +{% if nginx_enable_dynamic_modules %} +include {{ nginx_dir }}/modules-enabled/*; +{% endif %} + user {{nginx_user}}; worker_processes {{nginx_worker_processes}}; @@ -9,7 +13,6 @@ events { worker_connections {{nginx_worker_connections}}; } - http { include mime.types; default_type application/octet-stream; From a132aa9311e7f6bf46b7d79eb06e8475b00b2169 Mon Sep 17 00:00:00 2001 From: Nick Iv Date: Tue, 19 Dec 2017 12:20:00 +0300 Subject: [PATCH 3/4] Add nginx streams parameter to nginx.conf template --- templates/nginx.conf.j2 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index ee98c72..368395b 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -13,6 +13,12 @@ events { worker_connections {{nginx_worker_connections}}; } +{% if nginx_streams_dir %} +streams { + include {{nginx_streams_dir}}/*; +} +{% endif %} + http { include mime.types; default_type application/octet-stream; @@ -61,13 +67,10 @@ http { {% if nginx_servers %}{% for server_config in nginx_servers %} server { - - {{ server_config.split('\n')|join('\t\n') }} - + {{ server_config.split('\n')|join('\t\n') }} } {% endfor %}{% endif %} include {{nginx_dir}}/conf.d/*.conf; include {{nginx_sites_dir}}/*; - } From cce828e386eb97d180ba2b8caed46df6e5fb48db Mon Sep 17 00:00:00 2001 From: Nick Iv Date: Tue, 19 Dec 2017 15:36:18 +0300 Subject: [PATCH 4/4] "Streams" typo fix --- templates/nginx.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 368395b..37cbb10 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -14,7 +14,7 @@ events { } {% if nginx_streams_dir %} -streams { +stream { include {{nginx_streams_dir}}/*; } {% endif %}