From f3b1890de2b4f841cf864ff88d641f36c3b43dc7 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 10 Oct 2020 23:22:04 +0200 Subject: [PATCH] updated nginx state --- states/nginx/config.sls | 4 ---- states/nginx/templates/types/zabbix.j2 | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 states/nginx/templates/types/zabbix.j2 diff --git a/states/nginx/config.sls b/states/nginx/config.sls index 22211a1..299bd0e 100644 --- a/states/nginx/config.sls +++ b/states/nginx/config.sls @@ -31,10 +31,6 @@ nginx-config-dir-{{ subdir }}: - service: nginx-service {%- endfor %} -{#% for vhost in salt['file.find']( nginx.config.dir+'/sites-enabled/',type='f') %#} -{#% do salt['file.remove'](vhost) %#} -{#% endfor %#} - {%- for key, vhost in nginx.vhosts.items() %} nginx-sites-available-{{ key }}: file.managed: diff --git a/states/nginx/templates/types/zabbix.j2 b/states/nginx/templates/types/zabbix.j2 new file mode 100644 index 0000000..b7a12a1 --- /dev/null +++ b/states/nginx/templates/types/zabbix.j2 @@ -0,0 +1,22 @@ +## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} + +server { + include http; + server_name {{ vhost_name }}; + return 301 https://$server_name$request_uri; +} + +server { + include https; + server_name {{ vhost_name }}; + root {{ root_dir }}; + + index index.php index.html; + + location ~ \.php?$ { + include fastcgi_params; + fastcgi_pass unix:{{ php_socket_file }}; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; + } +}