updated nginx state

This commit is contained in:
Paul 2022-07-16 00:48:12 +02:00
parent 2933d3985e
commit b94e325c65
3 changed files with 51 additions and 0 deletions

View File

@ -56,6 +56,7 @@ nginx-sites-available-{{ key }}:
internal_access: {{ vhost.internal_access|default(false) }}
auth: {{ vhost.auth|default(false) }}
dirs: {{ vhost.dirs|default([]) }}
headers: {{ vhost.headers|default({}) }}
php_socket_file: {{ nginx.config.php_socket_file }}
nginx-site-enabled-{{ key }}:

View File

@ -33,6 +33,9 @@ server {
auth_basic "Restricted area";
auth_basic_user_file {{ config_dir }}/auth/htpasswd;
{%- endif %}
{%- for key,value in headers.items() %}
add_header {{ key }} {{ value }};
{% endfor -%}
}
{%- for dir in dirs %}

View File

@ -0,0 +1,47 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
server {
include http;
server_name {{ vhost_name }};
return 301 https://$server_name$request_uri;
}
server {
include https;
{%- if internal_access %}
include access;
{%- endif %}
server_name {{ vhost_name }};
{%- if not proxy %}
root "{{ root_dir }}";
{%- endif %}
location / {
{%- if proxy %}
proxy_pass {{ proxy_pass }};
{%- if not cache %}
proxy_no_cache 1;
proxy_cache_bypass 1;
{%- endif %}
{%- endif %}
{%- if autoindex %}
autoindex on;
autoindex_localtime on;
{%- else %}
index index.html index.rss;
{% endif %}
{%- if auth %}
auth_basic "Restricted area";
auth_basic_user_file {{ config_dir }}/auth/htpasswd;
{%- endif %}
}
{%- for dir in dirs %}
location {{ dir.name }} {
alias {{ dir.alias }};
}
{%- endfor %}
location /robots.txt {
return 200 "User-agent: *\r\nDisallow: /";
}
}