blob: 66ce0d518644df7503abdebfcf61037bcabcfa59 (
plain)
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
|
upstream {{.Name}}_upstream {
server {{.IP}}:{{.Port}};
}
{{range .Domains}}
server {
listen 80;
server_name {{.Hostname}};
location ^~ /.well-known/acme-challenge/ {
root {{$.Webroot}};
}
location / {
{{if .CertLive}}
return 301 https://{{$.PrimaryHostname}}$request_uri;
{{else if .Primary}}
proxy_pass http://{{$.Name}}_upstream;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
{{else if $.PrimaryCertLive}}
return 301 https://{{$.PrimaryHostname}}$request_uri;
{{else}}
return 301 http://{{$.PrimaryHostname}}$request_uri;
{{end}}
}
}
{{if .CertLive}}
server {
listen 443 ssl;
server_name {{.Hostname}};
ssl_certificate {{$.PrimaryLiveDir}}/fullchain.pem;
ssl_certificate_key {{$.PrimaryLiveDir}}/privkey.pem;
location / {
{{if .Primary}}
proxy_pass http://{{$.Name}}_upstream;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
{{else}}
return 301 https://{{$.PrimaryHostname}}$request_uri;
{{end}}
}
}
{{end}}
{{end}}
|