Add optional IP restriction for nginx site configs
This commit is contained in:
parent
e3f03edf3f
commit
3102c621f0
@ -35,6 +35,12 @@ server {
|
|||||||
client_max_body_size {{ item.client_max_body_size }};
|
client_max_body_size {{ item.client_max_body_size }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
location / {
|
location / {
|
||||||
|
{% if item.allowedips is defined %}
|
||||||
|
{% for ip in item.allowedips %}
|
||||||
|
allow {{ ip }};
|
||||||
|
{% endfor %}
|
||||||
|
deny all;
|
||||||
|
{% endif %}
|
||||||
{% if item.restrict is defined and item.restrict %}
|
{% if item.restrict is defined and item.restrict %}
|
||||||
auth_basic "{{ item.restrict_name | default('Restricted Access') }}";
|
auth_basic "{{ item.restrict_name | default('Restricted Access') }}";
|
||||||
auth_basic_user_file {{ item.restrict_file | default('/etc/nginx/.htpasswd') }};
|
auth_basic_user_file {{ item.restrict_file | default('/etc/nginx/.htpasswd') }};
|
||||||
|
Loading…
Reference in New Issue
Block a user