bundles/nginx: redirect domain_aliases to primary domain
This commit is contained in:
parent
fa375d0d69
commit
050931edf2
1 changed files with 43 additions and 8 deletions
|
@ -12,7 +12,7 @@ server {
|
||||||
|
|
||||||
% if ssl:
|
% if ssl:
|
||||||
location / {
|
location / {
|
||||||
return 308 https://$host$request_uri;
|
return 301 https://${domain}$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
% if ssl == 'letsencrypt':
|
% if ssl == 'letsencrypt':
|
||||||
|
@ -22,12 +22,47 @@ server {
|
||||||
% endif
|
% endif
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
% if domain_aliases:
|
% if domain_aliases:
|
||||||
server_name ${domain} ${' '.join(sorted(domain_aliases))};
|
server {
|
||||||
|
server_name ${' '.join(sorted(domain_aliases))};
|
||||||
|
|
||||||
|
root ${webroot if webroot else '/var/www/{}/'.format(vhost)};
|
||||||
|
index ${' '.join(index)};
|
||||||
|
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
|
||||||
|
% if ssl == 'letsencrypt':
|
||||||
|
ssl_certificate /var/lib/dehydrated/certs/${domain}/fullchain.pem;
|
||||||
|
ssl_certificate_key /var/lib/dehydrated/certs/${domain}/privkey.pem;
|
||||||
% else:
|
% else:
|
||||||
server_name ${domain};
|
ssl_certificate /etc/nginx/ssl/${vhost}.crt;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/${vhost}.key;
|
||||||
% endif
|
% endif
|
||||||
|
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
||||||
|
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;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_tickets off;
|
||||||
|
|
||||||
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
|
||||||
|
|
||||||
|
% if ssl == 'letsencrypt':
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
alias /var/lib/dehydrated/acme-challenges/;
|
||||||
|
}
|
||||||
|
% endif
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://${domain}$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
% endif
|
||||||
|
server {
|
||||||
|
server_name ${domain};
|
||||||
|
|
||||||
root ${webroot if webroot else '/var/www/{}/'.format(vhost)};
|
root ${webroot if webroot else '/var/www/{}/'.format(vhost)};
|
||||||
index ${' '.join(index)};
|
index ${' '.join(index)};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue