Improve acme-challenge handling
so that there is no need anymore for the Let's Encrypt companion to fiddle with vhosts nginx configuration.
This commit is contained in:
parent
3cbc5417b7
commit
b73ffd88ab
1 changed files with 6 additions and 1 deletions
|
@ -239,9 +239,14 @@ upstream {{ $upstream_name }} {
|
|||
{{/* Use the cert specified on the container or fallback to the best vhost match */}}
|
||||
{{ $cert := (coalesce $certName $vhostCert) }}
|
||||
|
||||
{{ $is_https := (and (ne $https_method "nohttps") (ne $cert "") (exists (printf "/etc/nginx/certs/%s.crt" $cert)) (exists (printf "/etc/nginx/certs/%s.key" $cert))) }}
|
||||
{{ $is_https := (ne $https_method "nohttps") }}
|
||||
|
||||
{{ if $is_https }}
|
||||
{{/* No cert? But we do want HTTPS! Let's fallback on the nginx default one.
|
||||
And set up acme-challenge so that Let's Encrpyt can do its job */}}
|
||||
{{ $cert := coalesce $cert "default" }}
|
||||
{{/* Very same reasoning as above */}}
|
||||
{{ $cert := when (and (exists (printf "/etc/nginx/certs/%s.crt" $cert)) (exists (printf "/etc/nginx/certs/%s.key" $cert))) $cert "default" }}
|
||||
|
||||
{{ if eq $https_method "redirect" }}
|
||||
server {
|
||||
|
|
Loading…
Reference in a new issue