@@ -82,46 +82,15 @@ server {
8282{# --- Server section --- #}
8383
8484{% for s in declaration.servers %}
85+ server {
8586 {# --- Listen section start --- #}
8687 {%- if s.listen -%}
8788 {% if s.listen.address %}
8889
89- server {
9090 listen {{ s.listen.address }}{% if s.listen.tls and s.listen.tls.certificate %} ssl{% endif %};
9191 {% if s.listen.http2 and s.listen.http2 == True -%}http2 on;{% endif -%}
9292 {%- endif %}
9393
94- {% if s.names -%}
95- server_name{% for svrname in s.names %} {{ svrname }}{% endfor -%};
96- status_zone {{ s.names[0] }};
97- proxy_set_header Host $host;
98- proxy_ssl_server_name on;
99- {% endif -%}
100-
101- {% if s.resolver -%}
102- resolver {{ s.resolver }};
103- {% endif -%}
104-
105- {# --- Server NGINX App Protect WAF section start --- #}
106-
107- {% if s.app_protect -%}
108- {% if s.app_protect.enabled == True -%}
109- app_protect_enable on;
110- {% endif -%}
111- {% if s.app_protect.policy -%}
112- app_protect_policy_file {{ ncgconfig.nms.nap_policies_dir_pum }}/{{ s.app_protect.policy }}.tgz;
113- {% endif -%}
114- {% if s.app_protect.log -%}
115- {% if s.app_protect.log.enabled == True -%}
116- app_protect_security_log_enable on;
117- {% if s.app_protect.log.profile_name -%}
118- app_protect_security_log "{{ ncgconfig.nms.nap_logformats_dir_pum }}/{{ s.app_protect.log.profile_name }}.tgz" syslog:server={{ s.app_protect.log.destination }};
119- {% endif -%}
120- {% endif %}
121- {% endif %}
122- {% endif %}
123- {# --- Server NGINX App Protect WAF section end --- #}
124-
12594 {# --- TLS section start --- #}
12695 {%- if s.listen.tls -%}
12796
@@ -177,6 +146,37 @@ server {
177146 {%- endif %}
178147 {# --- Listen section end --- #}
179148
149+ {% if s.names -%}
150+ server_name{% for svrname in s.names %} {{ svrname }}{% endfor -%};
151+ status_zone {{ s.names[0] }};
152+ proxy_set_header Host $host;
153+ proxy_ssl_server_name on;
154+ {% endif -%}
155+
156+ {% if s.resolver -%}
157+ resolver {{ s.resolver }};
158+ {% endif -%}
159+
160+ {# --- Server NGINX App Protect WAF section start --- #}
161+
162+ {% if s.app_protect -%}
163+ {% if s.app_protect.enabled == True -%}
164+ app_protect_enable on;
165+ {% endif -%}
166+ {% if s.app_protect.policy -%}
167+ app_protect_policy_file {{ ncgconfig.nms.nap_policies_dir_pum }}/{{ s.app_protect.policy }}.tgz;
168+ {% endif -%}
169+ {% if s.app_protect.log -%}
170+ {% if s.app_protect.log.enabled == True -%}
171+ app_protect_security_log_enable on;
172+ {% if s.app_protect.log.profile_name -%}
173+ app_protect_security_log "{{ ncgconfig.nms.nap_logformats_dir_pum }}/{{ s.app_protect.log.profile_name }}.tgz" syslog:server={{ s.app_protect.log.destination }};
174+ {% endif -%}
175+ {% endif %}
176+ {% endif %}
177+ {% endif %}
178+ {# --- Server NGINX App Protect WAF section end --- #}
179+
180180 {% if s.log.access %}access_log {{ s.log.access }} main;{% endif %}
181181
182182 {% if s.log.error %}error_log {{ s.log.error }};{% endif %}
@@ -239,8 +239,7 @@ server {
239239 }
240240 {% endfor %}
241241
242- {%- if s.listen.address %}
242+ {% if s.listen.address %}
243+ {%- endif -%}
243244}
244- {% endif %}
245-
246- {% endfor %}
245+ {%- endfor %}
0 commit comments