Update nginx.tmpl

- Add VIRTUAL_PROTO=custome
This commit is contained in:
废墟 2022-07-16 20:45:14 +08:00
parent c4ad18fecc
commit 76ba6b6f58

View file

@ -51,6 +51,11 @@
{{ end }} {{ end }}
{{ define "location" }} {{ define "location" }}
{{ if eq .Proto "custome" }}
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" .Host)) }}
include {{ printf "/etc/nginx/vhost.d/%s_location" .Host }};
{{ end }}
{{ else }}
location {{ .Path }} { location {{ .Path }} {
{{ if eq .NetworkTag "internal" }} {{ if eq .NetworkTag "internal" }}
# Only allow traffic from internal clients # Only allow traffic from internal clients
@ -78,11 +83,12 @@
{{ if (exists (printf "/etc/nginx/vhost.d/%s_%s_location" .Host (sha1 .Path) )) }} {{ if (exists (printf "/etc/nginx/vhost.d/%s_%s_location" .Host (sha1 .Path) )) }}
include {{ printf "/etc/nginx/vhost.d/%s_%s_location" .Host (sha1 .Path) }}; include {{ printf "/etc/nginx/vhost.d/%s_%s_location" .Host (sha1 .Path) }};
{{ else if (exists (printf "/etc/nginx/vhost.d/%s_location" .Host)) }} {{ else if (exists (printf "/etc/nginx/vhost.d/%s_location" .Host)) }}
include {{ printf "/etc/nginx/vhost.d/%s_location" .Host}}; include {{ printf "/etc/nginx/vhost.d/%s_location" .Host }};
{{ else if (exists "/etc/nginx/vhost.d/default_location") }} {{ else if (exists "/etc/nginx/vhost.d/default_location") }}
include /etc/nginx/vhost.d/default_location; include /etc/nginx/vhost.d/default_location;
{{ end }} {{ end }}
} }
{{ end }}
{{ end }} {{ end }}
{{ define "upstream" }} {{ define "upstream" }}