allow one .htpasswd file for all VIRTUAL_HOST’s @mark-wff
This commit is contained in:
parent
fdb69bda06
commit
b61b46d1c0
1 changed files with 6 additions and 1 deletions
|
@ -353,10 +353,12 @@ server {
|
|||
proxy_pass {{ trim $proto }}://{{ trim $container.Name }};
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
||||
auth_basic "Restricted {{ $host }}";
|
||||
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
||||
{{ else if (exists ("/etc/nginx/htpasswd/.htpasswd")) }}
|
||||
auth_basic "Restricted {{ $host }}";
|
||||
auth_basic_user_file {{ "/etc/nginx/htpasswd/.htpasswd" }};
|
||||
{{ end }}
|
||||
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
|
||||
include {{ printf "/etc/nginx/vhost.d/%s_location" $host}};
|
||||
|
@ -435,6 +437,9 @@ server {
|
|||
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
||||
auth_basic "Restricted {{ $host }}";
|
||||
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
||||
{{ else if (exists ("/etc/nginx/htpasswd/.htpasswd")) }}
|
||||
auth_basic "Restricted {{ $host }}";
|
||||
auth_basic_user_file {{ "/etc/nginx/htpasswd/.htpasswd" }};
|
||||
{{ end }}
|
||||
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
|
||||
include {{ printf "/etc/nginx/vhost.d/%s_location" $host}};
|
||||
|
|
Loading…
Reference in a new issue