42 lines
1.3 KiB
Text
42 lines
1.3 KiB
Text
|
|
apiVersion: v1
|
||
|
|
kind: ConfigMap
|
||
|
|
metadata:
|
||
|
|
name: {{ taskserv.name }}-nginx-conf
|
||
|
|
namespace: {{ taskserv.namespace }}
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: {{ taskserv.name }}
|
||
|
|
app.kubernetes.io/managed-by: provisioning
|
||
|
|
data:
|
||
|
|
nginx.conf: |
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name {{ taskserv.domain }};
|
||
|
|
root {{ taskserv.data_dir }};
|
||
|
|
index index.html index.htm;
|
||
|
|
gzip on;
|
||
|
|
gzip_vary on;
|
||
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml application/xml;
|
||
|
|
location /_health {
|
||
|
|
access_log off;
|
||
|
|
return 200 "ok\n";
|
||
|
|
add_header Content-Type text/plain;
|
||
|
|
}
|
||
|
|
{% for ap in taskserv.auth_paths %}
|
||
|
|
location {{ ap.path }} {
|
||
|
|
auth_basic "{{ ap.realm | default(value="Restricted") }}";
|
||
|
|
auth_basic_user_file /etc/nginx/auth/{{ ap.slug }}.htpasswd;
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
{% endfor %}
|
||
|
|
{% if taskserv.auth_paths | filter(attribute="path", value="/") | length == 0 %}
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
{% endif %}
|
||
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot)$ {
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
}
|
||
|
|
{{ taskserv.nginx_conf_extra }}
|
||
|
|
}
|