mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 01:38:15 +00:00
fix: minor fixes on nginx template
This commit is contained in:
parent
01446472dd
commit
b6b7133a2e
18
nginx.tmpl
18
nginx.tmpl
@ -61,8 +61,8 @@ location {{ .Path }} {
|
|||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_pass {{ trim .Proto }}://{{ trim .Upstream }};
|
uwsgi_pass {{ trim .Proto }}://{{ trim .Upstream }};
|
||||||
{{ else if eq .Proto "fastcgi" }}
|
{{ else if eq .Proto "fastcgi" }}
|
||||||
root {{ trim .Vhostroot }};
|
root {{ trim .VhostRoot }};
|
||||||
include fastcgi.conf;
|
include fastcgi_params;
|
||||||
fastcgi_pass {{ trim .Upstream }};
|
fastcgi_pass {{ trim .Upstream }};
|
||||||
{{ else if eq .Proto "grpc" }}
|
{{ else if eq .Proto "grpc" }}
|
||||||
grpc_pass {{ trim .Proto }}://{{ trim .Upstream }};
|
grpc_pass {{ trim .Proto }}://{{ trim .Upstream }};
|
||||||
@ -85,7 +85,7 @@ location {{ .Path }} {
|
|||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "upstream-definition" }}
|
{{ define "upstream" }}
|
||||||
{{ $networks := .Networks }}
|
{{ $networks := .Networks }}
|
||||||
{{ $debug_all := .Debug }}
|
{{ $debug_all := .Debug }}
|
||||||
upstream {{ .Upstream }} {
|
upstream {{ .Upstream }} {
|
||||||
@ -263,13 +263,13 @@ server {
|
|||||||
|
|
||||||
{{ if eq $nPaths 0 }}
|
{{ if eq $nPaths 0 }}
|
||||||
# {{ $host }}
|
# {{ $host }}
|
||||||
{{ template "upstream-definition" (dict "Upstream" $upstream_name "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }}
|
{{ template "upstream" (dict "Upstream" $upstream_name "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $path, $containers := $paths }}
|
{{ range $path, $containers := $paths }}
|
||||||
{{ $sum := sha1 $path }}
|
{{ $sum := sha1 $path }}
|
||||||
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
|
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
|
||||||
# {{ $host }}{{ $path }}
|
# {{ $host }}{{ $path }}
|
||||||
{{ template "upstream-definition" (dict "Upstream" $upstream "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }}
|
{{ template "upstream" (dict "Upstream" $upstream "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ server {
|
|||||||
|
|
||||||
{{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}}
|
{{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}}
|
||||||
{{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }}
|
{{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }}
|
||||||
{{ template "location" (dict "Path" "/" "Proto" $proto "Upstream" $upstream_name "Host" $host "Vhostroot" $vhost_root "Dest" "" "NetworkTag" $network_tag) }}
|
{{ template "location" (dict "Path" "/" "Proto" $proto "Upstream" $upstream_name "Host" $host "VhostRoot" $vhost_root "Dest" "" "NetworkTag" $network_tag) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $path, $container := $paths }}
|
{{ range $path, $container := $paths }}
|
||||||
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost-vpath, falling back to "http" */}}
|
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost-vpath, falling back to "http" */}}
|
||||||
@ -399,7 +399,7 @@ server {
|
|||||||
{{ $sum := sha1 $path }}
|
{{ $sum := sha1 $path }}
|
||||||
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
|
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
|
||||||
{{ $dest := (or (first (groupByKeys $container "Env.VIRTUAL_DEST")) "") }}
|
{{ $dest := (or (first (groupByKeys $container "Env.VIRTUAL_DEST")) "") }}
|
||||||
{{ template "location" (dict "Path" $path "Proto" $proto "Upstream" $upstream "Host" $host "Vhostroot" $vhost_root "Dest" $dest "NetworkTag" $network_tag) }}
|
{{ template "location" (dict "Path" $path "Proto" $proto "Upstream" $upstream "Host" $host "VhostRoot" $vhost_root "Dest" $dest "NetworkTag" $network_tag) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if (not (contains $paths "/")) }}
|
{{ if (not (contains $paths "/")) }}
|
||||||
location / {
|
location / {
|
||||||
@ -436,7 +436,7 @@ server {
|
|||||||
|
|
||||||
{{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}}
|
{{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}}
|
||||||
{{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }}
|
{{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }}
|
||||||
{{ template "location" (dict "Path" "/" "Proto" $proto "Upstream" $upstream_name "Host" $host "Vhostroot" $vhost_root "Dest" "" "NetworkTag" $network_tag) }}
|
{{ template "location" (dict "Path" "/" "Proto" $proto "Upstream" $upstream_name "Host" $host "VhostRoot" $vhost_root "Dest" "" "NetworkTag" $network_tag) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $path, $container := $paths }}
|
{{ range $path, $container := $paths }}
|
||||||
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost-vpath, falling back to "http" */}}
|
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost-vpath, falling back to "http" */}}
|
||||||
@ -447,7 +447,7 @@ server {
|
|||||||
{{ $sum := sha1 $path }}
|
{{ $sum := sha1 $path }}
|
||||||
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
|
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
|
||||||
{{ $dest := (or (first (groupByKeys $container "Env.VIRTUAL_DEST")) "") }}
|
{{ $dest := (or (first (groupByKeys $container "Env.VIRTUAL_DEST")) "") }}
|
||||||
{{ template "location" (dict "Path" $path "Proto" $proto "Upstream" $upstream "Host" $host "Vhostroot" $vhost_root "Dest" $dest "NetworkTag" $network_tag) }}
|
{{ template "location" (dict "Path" $path "Proto" $proto "Upstream" $upstream "Host" $host "VhostRoot" $vhost_root "Dest" $dest "NetworkTag" $network_tag) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if (not (contains $paths "/")) }}
|
{{ if (not (contains $paths "/")) }}
|
||||||
location / {
|
location / {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user