nginx/templates/etc/nginx/sites-available/base.j2

46 lines
986 B
Django/Jinja

{% extends "core.j2" %}
{% block root %}
root {{ nginx_www_dir }}{{ item.root }};
index {{ item.index }};
{% endblock %}
{% block location %}
location / {
try_files {{ item.override_try_files | default('$uri $uri/ =404') }};
{% endblock %}
{% block app_root_location %}
{% endblock %}
}
{% block extra_locations %}
{% endblock %}
{% block custom_locations %}
{% endblock %}
{% block local_content %}
{% if item.manage_local_content is not defined %}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
deny all;
}
{% if item.favicon is defined %}
location /favicon.ico {
alias {{ item.favicon }};
expires 30d;
access_log off;
log_not_found off;
}
{% endif %}
location ~* \.(txt|js|css|png|jpe?g|gif|ico|svg)$ {
expires 30d;
log_not_found off;
}
{% endif %}
{% endblock %}