fix: use most specific custom location config first

Co-authored-by: Jonathan Underwood <junderwood@bitcoinbank.co.jp>
This commit is contained in:
Nicolas Duchon 2021-08-14 21:38:13 +02:00
parent d48ba070b7
commit 89eaadef9c
No known key found for this signature in database
GPG key ID: EA3151C66A4D79E7

View file

@ -68,10 +68,10 @@ location {{ .Path }} {
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" .Host) }};
{{ end }}
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" .Host)) }}
include {{ printf "/etc/nginx/vhost.d/%s_location" .Host}};
{{ else 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) }};
{{ else if (exists (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") }}
include /etc/nginx/vhost.d/default_location;
{{ end }}