Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit bf417e5

Browse files
committed
Bring nginx-vhost.j2 in inline with upstream version
Added support for: - item.index - item.access_log - item.error_log Left out on purpose: - item.error_page - item.return
1 parent 2882ce7 commit bf417e5

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

provisioning/templates/nginx-vhost.conf.j2

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
{% block redirect %}
1+
{% block server_redirect %}
22
{% if item.server_name_redirect is defined %}
33
server {
44
listen 80;
55
server_name {{ item.server_name_redirect }};
6-
return 301 http://{{ item.server_name.split(' ')[0] }}$request_uri;
6+
return 301 $scheme://{{ item.server_name.split(' ')[0] }}$request_uri;
77
}
88
{% endif %}
99
{% endblock %}
1010

1111
server {
12-
{% block server_id -%}
13-
listen {{ item.listen | default("80") }};
12+
{% block server_begin %}{% endblock %}
13+
14+
{% block server_basic -%}
15+
listen {{ item.listen | default('80') }};
1416
server_name {{ item.server_name }};
17+
root {{ item.root }};
18+
index {{ item.index | default('index.php index.html index.htm') }};
1519
{% endblock %}
1620

1721
{% block server_logs -%}
18-
error_log /var/log/nginx/error.log info;
19-
{% endblock %}
20-
21-
{% block server_basics -%}
22-
root {{ item.root }};
23-
index index.php index.html index.htm;
22+
{% if item.access_log is defined -%}
23+
access_log {{ item.access_log }};
24+
{% endif %}
25+
error_log {{ item.error_log|default('/var/log/nginx/error.log') }} info;
2426
{% endblock %}
2527

2628
{% if item.is_php is defined and item.is_php %}
@@ -99,7 +101,7 @@ server {
99101
{% endblock %}
100102
{% endif %}
101103

102-
{% block compression -%}
104+
{% block server_compression -%}
103105
gzip on;
104106
gzip_proxied any;
105107
gzip_static on;
@@ -126,7 +128,9 @@ server {
126128
gzip_min_length 512;
127129
{% endblock %}
128130

131+
{% block server_end %}{% endblock %}
132+
129133
{% if item.extra_parameters is defined %}
130-
{{ item.extra_parameters }}
134+
{{ item.extra_parameters|indent(4) }}
131135
{% endif %}
132136
}

0 commit comments

Comments
 (0)