瀏覽代碼

Make possible to define config parameters in nginx http section

Emmanuel Bouthenot 9 年之前
父節點
當前提交
10320b8eb0
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 1 0
      roles/webserver/defaults/main.yml
  2. 7 0
      roles/webserver/templates/nginx/nginx.conf.j2

+ 1 - 0
roles/webserver/defaults/main.yml

@@ -9,6 +9,7 @@ with_nginx: False
 # nginx_workers ~= $(getconf _NPROCESSORS_ONLN)
 nginx_workers: 2
 nginx_ssl_strengthened: False
+nginx_http_config: Null
 
 with_modphp5: False
 

+ 7 - 0
roles/webserver/templates/nginx/nginx.conf.j2

@@ -177,6 +177,13 @@ http {
 
     ### Extended configuration ###
 
+{% if nginx_http_config %}
+    # Custom settings
+{%for param in nginx_http_config %}
+    {{ param }} {{ nginx_http_config[param] }};
+{% endfor %}
+{% endif %}
+
     # More configuration parameters
     include /etc/nginx/conf.d/*.conf;