59 lines
1.6 KiB
Django/Jinja
59 lines
1.6 KiB
Django/Jinja
server {
|
|
{% if item.listen_v4 | default(nginx_vh_listen_v4) %}
|
|
listen {{ item.listen_v4_host | default(nginx_vh_listen_v4_host) }}:80;
|
|
{% endif %}
|
|
{% if item.listen_v6 | default(nginx_vh_listen_v6) %}
|
|
listen [{{ item.listen_v6_host | default(nginx_vh_listen_v6_host) }}]:80;
|
|
{% endif %}
|
|
|
|
server_name {{ item.server_name }} {{ item.server_redirects | default("") }};
|
|
access_log /var/log/nginx/{{ item.name }}.log;
|
|
|
|
{% if item.server_name != "_" %}
|
|
location / {
|
|
return 301 https://{{ item.server_name }}$request_uri;
|
|
}
|
|
{% else %}
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
{% endif %}
|
|
}
|
|
|
|
server {
|
|
{% if item.listen_v4 | default(nginx_vh_listen_v4) %}
|
|
listen {{ item.listen_v4_host | default(nginx_vh_listen_v4_host) }}:443 ssl;
|
|
{% endif %}
|
|
{% if item.listen_v6 | default(nginx_vh_listen_v6) %}
|
|
listen [{{ item.listen_v6_host | default(nginx_vh_listen_v6_host) }}]:443 ssl;
|
|
{% endif %}
|
|
|
|
http2 on;
|
|
|
|
ssl_certificate {{ item.ssl_certificate | default(nginx_vh_ssl_certificate) }};
|
|
ssl_certificate_key {{ item.ssl_certificate_key | default(nginx_vh_ssl_certificate_key) }};
|
|
|
|
server_name {{ item.server_name }};
|
|
access_log /var/log/nginx/{{ item.name }}.log;
|
|
|
|
{% if item.root is defined %}
|
|
root {{ item.root }};
|
|
|
|
index index.html index.htm;
|
|
|
|
add_header X-AS205079-Server {{ shortname }};
|
|
{% if not item.hsts_disable | default(false) %}
|
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
{% endif %}
|
|
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
{% elif item.proxy_pass is defined %}
|
|
location / {
|
|
proxy_pass {{ item.proxy_pass }};
|
|
include proxy_params;
|
|
}
|
|
{% endif %}
|
|
}
|