blob: 7220a389158746a78f49d6b811e7760202b51195 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{% if server.http_redirect is defined and server.http_redirect %}
server {
listen 80;
server_name {{ server.name }};
return 301 https://$server_name$request_uri;
}
{% endif %}
{% if server.proxy is defined and server.proxy.cache is defined and server.proxy.cache %}
proxy_cache_path /usr/share/nginx/cache levels=1:2 keys_zone=cache_{{ short_name }}:10m max_size=100m inactive=60m use_temp_path=off;
{% endif %}
server {
{% if server.http_redirect is not defined or not server.http_redirect %}
listen 80;
{% endif %}
listen 443 ssl http2;
server_name {{ server.name }};
location / {
{% if server.dir is defined %}
root {{ server.dir }};
index index.html;
{% endif %}
{% if server.proxy is defined %}
proxy_pass http://{{server.proxy.host|default("localhost")}}:{{server.proxy.port|default("80")}};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_http_version 1.1;
{% if server.websocket is defined and server.websocket %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
{% endif %}
{% if server.proxy is defined %}
{% if server.proxy.cache is defined and server.proxy.cache %}
proxy_cache cache_{{ short_name }};
proxy_cache_revalidate on;
{% endif %}
{% if server.proxy.cache_when_origin_down is defined and server.proxy.cache_when_origin_down %}
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
{% endif %}
{% endif %}
{% if server.client_body_size is defined %}
client_max_body_size {{ server.client_body_size }};
{% endif %}
{% endif %}
}
}
|