From 50750bea5396e564c1e6262d921a0e295fa99086 Mon Sep 17 00:00:00 2001 From: Niek <100143256+SchoNie@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:21:02 +0100 Subject: [PATCH 1/2] highlight variables similar to other in readme --- docs/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index 9e26be5..09deae6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -515,8 +515,8 @@ To enable HTTP/3 globally set the environment variable `ENABLE_HTTP3` to `true` ### Basic Authentication Support -In order to be able to secure your virtual host, you have to create a file named as its equivalent VIRTUAL_HOST variable on directory -/etc/nginx/htpasswd/$VIRTUAL_HOST +In order to be able to secure your virtual host, you have to create a file named as its equivalent `VIRTUAL_HOST` variable in directory +`/etc/nginx/htpasswd/{$VIRTUAL_HOST}` ```console docker run -d -p 80:80 -p 443:443 \ @@ -526,10 +526,10 @@ docker run -d -p 80:80 -p 443:443 \ nginxproxy/nginx-proxy ``` -You'll need apache2-utils on the machine where you plan to create the htpasswd file. Follow these [instructions](http://httpd.apache.org/docs/2.2/programs/htpasswd.html) +If you want to define basic authentication for a `VIRTUAL_PATH`, you have to create a file named as `/etc/nginx/htpasswd/${VIRTUAL_HOST}_${VIRTUAL_PATH_SHA1}` +(where `$VIRTUAL_PATH_SHA1` is the SHA1 hash for the virtual path, you can use any SHA1 online generator to calculate it). -If you want to define basic authentication for a `VIRTUAL_PATH`, you have to create a file named as /etc/nginx/htpasswd/${VIRTUAL_HOST}_${VIRTUAL_PATH_SHA1} -(where $VIRTUAL_PATH_SHA1 is the SHA1 hash for the virtual path, you can use any SHA1 online generator to calculate it). +You'll need apache2-utils on the machine where you plan to create the htpasswd file. Follow these [instructions](http://httpd.apache.org/docs/programs/htpasswd.html) ### Upstream (Backend) Server HTTP Load Balancing Support From d4438b5a09e477880c8b09428e5c2ea73e126149 Mon Sep 17 00:00:00 2001 From: Niek <100143256+SchoNie@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:23:19 +0100 Subject: [PATCH 2/2] prevent double slash --- nginx.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index c72c1c7..783c643 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -276,7 +276,7 @@ {{- end }} {{- if (exists (printf "/etc/nginx/htpasswd/%s_%s" .Host (sha1 .Path) )) }} - auth_basic "Restricted {{ .Host }}/{{ .Path }}"; + auth_basic "Restricted {{ .Host }}{{ .Path }}"; auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s_%s" .Host (sha1 .Path)) }}; {{- else if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }} auth_basic "Restricted {{ .Host }}";