|
@@ -76,38 +76,46 @@
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
|
|
{{- define "location" }}
|
|
{{- define "location" }}
|
|
|
|
+ {{- $override := printf "/etc/nginx/vhost.d/%s_%s_location_override" .Host (sha1 .Path) }}
|
|
|
|
+ {{- if and (eq .Path "/") (not (exists $override)) }}
|
|
|
|
+ {{- $override = printf "/etc/nginx/vhost.d/%s_location_override" .Host }}
|
|
|
|
+ {{- end }}
|
|
|
|
+ {{- if exists $override }}
|
|
|
|
+ include {{ $override }};
|
|
|
|
+ {{- 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
|
|
include /etc/nginx/network_internal.conf;
|
|
include /etc/nginx/network_internal.conf;
|
|
- {{- end }}
|
|
|
|
|
|
+ {{- end }}
|
|
|
|
|
|
- {{- if eq .Proto "uwsgi" }}
|
|
|
|
|
|
+ {{- if eq .Proto "uwsgi" }}
|
|
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_params;
|
|
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 }};
|
|
- {{- else }}
|
|
|
|
|
|
+ {{- else }}
|
|
proxy_pass {{ trim .Proto }}://{{ trim .Upstream }}{{ trim .Dest }};
|
|
proxy_pass {{ trim .Proto }}://{{ trim .Upstream }}{{ trim .Dest }};
|
|
- {{- end }}
|
|
|
|
|
|
+ {{- end }}
|
|
|
|
|
|
- {{- if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }}
|
|
|
|
|
|
+ {{- if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }}
|
|
auth_basic "Restricted {{ .Host }}";
|
|
auth_basic "Restricted {{ .Host }}";
|
|
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" .Host) }};
|
|
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" .Host) }};
|
|
- {{- end }}
|
|
|
|
|
|
+ {{- end }}
|
|
|
|
|
|
- {{- 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" }}
|