Allow auth basic to be added to global (server) (#125)

* Add auth basic for global level

* Change auth_basic_file to auth_basic_user_file
This commit is contained in:
Sathish Ramani 2019-05-20 21:48:24 +08:00 committed by Grzegorz Dzien
parent 898c5a5f9c
commit df98f1a244
3 changed files with 18 additions and 8 deletions

View File

@ -330,6 +330,8 @@ nginx_http_template:
root: /usr/share/nginx/html
https_redirect: false
autoindex: false
auth_basic: null
auth_basic_user_file: null
#auth_request: /auth
ssl:
cert: /etc/ssl/certs/default.crt
@ -346,7 +348,7 @@ nginx_http_template:
html_file_name: index.html
autoindex: false
auth_basic: null
auth_basic_file: null
auth_basic_user_file: null
#auth_req: /auth
#returns:
#return302:
@ -432,7 +434,7 @@ nginx_http_template:
proxy_redirect: false
websocket: false
auth_basic: null
auth_basic_file: null
auth_basic_user_file: null
#auth_req: /auth
#returns:
#return302:

View File

@ -172,6 +172,8 @@ nginx_http_template:
root: /usr/share/nginx/html
https_redirect: false
autoindex: false
auth_basic: null
auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404
#auth_request: /auth
ssl:
@ -190,7 +192,7 @@ nginx_http_template:
html_file_name: index.html
autoindex: false
auth_basic: null
auth_basic_file: null
auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404
#auth_request: /auth
#returns:
@ -273,7 +275,7 @@ nginx_http_template:
- Cache-Control
websocket: false
auth_basic: null
auth_basic_file: null
auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404
#auth_req: /auth
#returns:

View File

@ -74,6 +74,12 @@ server {
listen {{ item.value.port }};
{% endif %}
server_name {{ item.value.server_name }};
{% if item.value.auth_basic is defined and item.value.auth_basic %}
auth_basic "{{ item.value.auth_basic }}";
{% endif %}
{% if item.value.auth_basic_user_file is defined and item.value.auth_basic_user_file %}
auth_basic_user_file {{ item.value.auth_basic_user_file }};
{% endif %}
{% if item.value.root is defined and item.value.root %}
root {{ item.value.root }};
{% endif %}
@ -102,8 +108,8 @@ server {
{% if item.value.reverse_proxy.locations[location].auth_basic is defined and item.value.reverse_proxy.locations[location].auth_basic %}
auth_basic "{{ item.value.reverse_proxy.locations[location].auth_basic }}";
{% endif %}
{% if item.value.reverse_proxy.locations[location].auth_basic_file is defined and item.value.reverse_proxy.locations[location].auth_basic_file %}
auth_basic_user_file {{ item.value.reverse_proxy.locations[location].auth_basic_file }};
{% if item.value.reverse_proxy.locations[location].auth_basic_user_file is defined and item.value.reverse_proxy.locations[location].auth_basic_user_file %}
auth_basic_user_file {{ item.value.reverse_proxy.locations[location].auth_basic_user_file }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].returns is defined %}
{% for code in item.value.reverse_proxy.locations[location].returns %}
@ -229,8 +235,8 @@ server {
{% if item.value.web_server.locations[location].auth_basic is defined and item.value.web_server.locations[location].auth_basic %}
auth_basic "{{ item.value.web_server.locations[location].auth_basic }}";
{% endif %}
{% if item.value.web_server.locations[location].auth_basic_file is defined and item.value.web_server.locations[location].auth_basic_file %}
auth_basic_user_file {{ item.value.web_server.locations[location].auth_basic_file }};
{% if item.value.web_server.locations[location].auth_basic_user_file is defined and item.value.web_server.locations[location].auth_basic_user_file %}
auth_basic_user_file {{ item.value.web_server.locations[location].auth_basic_user_file }};
{% endif %}
{% if item.value.web_server.locations[location].auth_request is defined %}
auth_request {{ item.value.web_server.locations[location].auth_request }};