From 319111b4e5f05e2783f4614ac61a245ca1b477ea Mon Sep 17 00:00:00 2001 From: Albert Murillo Date: Tue, 16 Dec 2014 21:16:22 +0100 Subject: [PATCH] Basic Authentication Support --- README.md | 9 --------- nginx.tmpl | 11 ----------- 2 files changed, 20 deletions(-) diff --git a/README.md b/README.md index f50796d..1371fba 100644 --- a/README.md +++ b/README.md @@ -95,12 +95,3 @@ Note that in the latter case, a browser may get an connection error as no certif to establish a connection. A self-signed or generic cert named `default.crt` and `default.key` will allow a client browser to make a SSL connection (likely w/ a warning) and subsequently receive a 503. - -### Basic Authentication Support - -In order to be able to securize your virtual host, you have to create a file named as its equivalent VIRTUAL_HOST variable on directory -/etc/nginx/htpasswd/$VIRTUAL_HOST - - $ docker run -d -p 80:80 -p 443:443 -v /path/to/htpasswd:/etc/nginx/htpasswd -v /path/to/certs:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy - -You'll need apache2-utils on the machine you plan to create de htpasswd file. Follow these [instructions](http://httpd.apache.org/docs/2.2/programs/htpasswd.html) diff --git a/nginx.tmpl b/nginx.tmpl index ebf0f33..3747678 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -68,9 +68,6 @@ upstream {{ $host }} { {{ end }} } -{{/* Get the htpasswd file defined by containers w/ the same vhost */}} -{{ $htpasswdFile := (first (groupByKeys $containers "Env.HTPASSWD_FILE”)) }} - {{/* Get the first cert name defined by containers w/ the same vhost */}} {{ $certName := (first (groupByKeys $containers "Env.CERT_NAME")) }} @@ -109,10 +106,6 @@ 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 }} @@ -122,10 +115,6 @@ 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 }} } }