Update nginx.tmpl
Move include of /vhost.d/default_location and location in order to affect htpasswd for example to avoid request auth to local network clients but requesting it to external clients.
This commit is contained in:
parent
73f29846b3
commit
fd240519c8
1 changed files with 11 additions and 10 deletions
21
nginx.tmpl
21
nginx.tmpl
|
|
@ -278,16 +278,16 @@ server {
|
||||||
{{ else }}
|
{{ else }}
|
||||||
proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};
|
proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
|
||||||
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
|
||||||
auth_basic "Restricted {{ $host }}";
|
|
||||||
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}};
|
include {{ printf "/etc/nginx/vhost.d/%s_location" $host}};
|
||||||
{{ else if (exists "/etc/nginx/vhost.d/default_location") }}
|
{{ else if (exists "/etc/nginx/vhost.d/default_location") }}
|
||||||
include /etc/nginx/vhost.d/default_location;
|
include /etc/nginx/vhost.d/default_location;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
||||||
|
auth_basic "Restricted {{ $host }}";
|
||||||
|
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,15 +325,16 @@ server {
|
||||||
{{ else }}
|
{{ else }}
|
||||||
proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};
|
proxy_pass {{ trim $proto }}://{{ trim $upstream_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) }};
|
|
||||||
{{ end }}
|
|
||||||
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
|
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
|
||||||
include {{ 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") }}
|
{{ else if (exists "/etc/nginx/vhost.d/default_location") }}
|
||||||
include /etc/nginx/vhost.d/default_location;
|
include /etc/nginx/vhost.d/default_location;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
||||||
|
auth_basic "Restricted {{ $host }}";
|
||||||
|
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue