1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-07-02 06:45:45 +00:00

Basic Authentication Support

This commit is contained in:
Albert Murillo Aguirre
2014-12-16 20:19:49 +01:00
committed by Jason Wilder
parent 56b4a2e182
commit 6d646d92f8
2 changed files with 17 additions and 0 deletions

View File

@ -106,6 +106,10 @@ server {
location / {
proxy_pass http://{{ $host }};
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
auth_basic "Restricted {{ $host }}";
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
{{ end }}
}
}
{{ else }}
@ -115,6 +119,10 @@ server {
location / {
proxy_pass http://{{ $host }};
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
auth_basic "Restricted {{ $host }}";
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
{{ end }}
}
}