merge conflicts
This commit is contained in:
commit
55aab66949
2 changed files with 30 additions and 17 deletions
|
@ -92,6 +92,10 @@ If your container exposes multiple ports, nginx-proxy will default to the servic
|
||||||
|
|
||||||
If you need to support multiple virtual hosts for a container, you can separate each entry with commas. For example, `foo.bar.com,baz.bar.com,bar.com` and each host will be setup the same.
|
If you need to support multiple virtual hosts for a container, you can separate each entry with commas. For example, `foo.bar.com,baz.bar.com,bar.com` and each host will be setup the same.
|
||||||
|
|
||||||
|
### Manually Specifying Upstream IP
|
||||||
|
|
||||||
|
In case you need to manually override the Upstream IP that Nginx will proxy to, you can declare a VIRTUAL_IP env var. If you do this, you also need to declare the VIRTUAL_PORT env variable as this switches the behaviour to a more "manual" declaration style. This is useful if one of your containers is in `network_mode: host` for instance.
|
||||||
|
|
||||||
### Wildcard Hosts
|
### Wildcard Hosts
|
||||||
|
|
||||||
You can also use wildcards at the beginning and the end of host name, like `*.bar.com` or `foo.bar.*`. Or even a regular expression, which can be very useful in conjunction with a wildcard DNS service like [xip.io](http://xip.io), using `~^foo\.bar\..*\.xip\.io` will match `foo.bar.127.0.0.1.xip.io`, `foo.bar.10.0.2.2.xip.io` and all other given IPs. More information about this topic can be found in the nginx documentation about [`server_names`](http://nginx.org/en/docs/http/server_names.html).
|
You can also use wildcards at the beginning and the end of host name, like `*.bar.com` or `foo.bar.*`. Or even a regular expression, which can be very useful in conjunction with a wildcard DNS service like [xip.io](http://xip.io), using `~^foo\.bar\..*\.xip\.io` will match `foo.bar.127.0.0.1.xip.io`, `foo.bar.10.0.2.2.xip.io` and all other given IPs. More information about this topic can be found in the nginx documentation about [`server_names`](http://nginx.org/en/docs/http/server_names.html).
|
||||||
|
|
13
nginx.tmpl
13
nginx.tmpl
|
@ -4,7 +4,10 @@
|
||||||
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
|
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
|
||||||
|
|
||||||
{{ define "upstream" }}
|
{{ define "upstream" }}
|
||||||
{{ if .Address }}
|
{{ if and .IP .Port }}
|
||||||
|
# {{ .Container.Name }} with manually set IP
|
||||||
|
server {{ .IP }}:{{ .Port }};
|
||||||
|
{{ else if .Address }}
|
||||||
{{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}}
|
{{/* 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 }}
|
{{ if and .Container.Node.ID .Address.HostPort }}
|
||||||
# {{ .Container.Node.Name }}/{{ .Container.Name }}
|
# {{ .Container.Node.Name }}/{{ .Container.Name }}
|
||||||
|
@ -22,7 +25,6 @@
|
||||||
server 127.0.0.1 down;
|
server 127.0.0.1 down;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "ssl_policy" }}
|
{{ define "ssl_policy" }}
|
||||||
|
@ -177,6 +179,12 @@ server {
|
||||||
upstream {{ $container.Name }} {
|
upstream {{ $container.Name }} {
|
||||||
{{ $addrLen := len $container.Addresses }}
|
{{ $addrLen := len $container.Addresses }}
|
||||||
|
|
||||||
|
{{ if and $container.Env.VIRTUAL_IP $container.Env.VIRTUAL_HOST }}
|
||||||
|
# Manually defined upstream host and port
|
||||||
|
{{ $IP := coalesce $container.Env.VIRTUAL_IP "127.0.0.1" }}
|
||||||
|
{{ $Port := coalesce $container.Env.VIRTUAL_PORT "80" }}
|
||||||
|
{{ template "upstream" (dict "Container" $container "Port" $Port "IP" $IP) }}
|
||||||
|
{{ else }}
|
||||||
{{ range $knownNetwork := $CurrentContainer.Networks }}
|
{{ range $knownNetwork := $CurrentContainer.Networks }}
|
||||||
{{ range $containerNetwork := $container.Networks }}
|
{{ range $containerNetwork := $container.Networks }}
|
||||||
{{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
|
{{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
|
||||||
|
@ -198,6 +206,7 @@ upstream {{ $container.Name }} {
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue