Skip to content

Instantly share code, notes, and snippets.

View buchdag's full-sized avatar

Nicolas Duchon buchdag

View GitHub Profile
@buchdag
buchdag / nginx.tmpl
Created December 8, 2017 22:35
nginx.tmpl not redirecting /.well-known/acme-challenge/ to https
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
{{ define "upstream" }}
{{ if .Address }}
{{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}}
{{ if and .Container.Node.ID .Address.HostPort }}
# {{ .Container.Node.Name }}/{{ .Container.Name }}
server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }};
{{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}}
{{ else if .Network }}