2020-06-01 08:52:52 +00:00
|
|
|
server {
|
|
|
|
server_name ${domain};
|
|
|
|
root ${webroot if webroot else '/var/www/{}/'.format(domain)};
|
|
|
|
index ${index if index else 'index.html index.htm'};
|
|
|
|
|
2020-09-20 12:36:43 +00:00
|
|
|
% if node.metadata['nginx']['use_ssl_for_all_connections']:
|
2020-06-01 08:52:52 +00:00
|
|
|
listen 443 ssl http2;
|
|
|
|
listen [::]:443 ssl http2;
|
|
|
|
|
2020-07-19 10:10:19 +00:00
|
|
|
ssl_trusted_certificate /var/lib/dehydrated/certs/${domain}/chain.pem;
|
2020-06-01 08:52:52 +00:00
|
|
|
ssl_certificate /var/lib/dehydrated/certs/${domain}/fullchain.pem;
|
|
|
|
ssl_certificate_key /var/lib/dehydrated/certs/${domain}/privkey.pem;
|
|
|
|
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
2020-06-01 09:01:00 +00:00
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
2020-06-01 08:52:52 +00:00
|
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
2020-09-20 12:36:43 +00:00
|
|
|
% else:
|
|
|
|
listen 80 http2;
|
|
|
|
listen [::]:80 http2;
|
|
|
|
% endif
|
2020-07-19 10:10:19 +00:00
|
|
|
|
|
|
|
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
|
|
|
resolver_timeout 5s;
|
2020-06-01 08:52:52 +00:00
|
|
|
|
2020-08-14 06:23:41 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
|
2020-07-19 09:26:12 +00:00
|
|
|
|
|
|
|
% if not do_not_set_content_security_headers:
|
2020-06-01 09:31:13 +00:00
|
|
|
add_header Referrer-Policy same-origin;
|
2020-08-18 13:07:43 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2020-06-01 09:31:13 +00:00
|
|
|
add_header X-Content-Type-Options nosniff;
|
2020-07-19 09:26:12 +00:00
|
|
|
% endif
|
2020-06-01 08:52:52 +00:00
|
|
|
|
2020-06-01 09:16:22 +00:00
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
alias /var/lib/dehydrated/acme-challenges/;
|
|
|
|
}
|
|
|
|
|
2020-06-01 09:31:13 +00:00
|
|
|
% if proxy:
|
|
|
|
% for location, proxy_pass in proxy.items():
|
|
|
|
location ${location} {
|
|
|
|
proxy_pass ${proxy_pass};
|
2020-08-19 19:43:37 +00:00
|
|
|
proxy_set_header Host ${domain};
|
2020-06-01 09:31:13 +00:00
|
|
|
proxy_set_header X-Script-Name /;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto HTTPS;
|
|
|
|
proxy_set_header X-Forwarded-Host ${domain};
|
|
|
|
proxy_buffering off;
|
|
|
|
}
|
|
|
|
% endfor
|
|
|
|
% endif
|
|
|
|
|
2020-07-19 09:09:53 +00:00
|
|
|
% if php:
|
|
|
|
location ~ \.php$ {
|
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
|
|
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
|
|
|
}
|
|
|
|
% endif
|
|
|
|
|
2020-06-01 08:52:52 +00:00
|
|
|
% if extras:
|
|
|
|
<%include file="extras/${node.name}/${domain}" />
|
|
|
|
% endif
|
|
|
|
}
|