82 lines
2.2 KiB
Django/Jinja
82 lines
2.2 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
# commit: {{ lookup('pipe', 'git rev-parse --short HEAD') }}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name {{ nextcloud_prefix }}.{{ domain }};
|
|
|
|
##
|
|
# SSL
|
|
##
|
|
ssl_session_cache builtin:1000 shared:SSL:10m;
|
|
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
|
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_dhparam {{ ssl_dir }}/dhparams.pem;
|
|
ssl_ecdh_curve secp384r1;
|
|
ssl_certificate {{ certs_dir }}/{{ domain | get_tld }}/cert.pem;
|
|
ssl_certificate_key {{ certs_dir }}/{{ domain | get_tld }}/key.pem;
|
|
|
|
##
|
|
# OCSP Stapling
|
|
##
|
|
ssl_stapling on;
|
|
ssl_stapling_verify on;
|
|
resolver {{ dns_resolvers }} valid=300s;
|
|
ssl_trusted_certificate {{ certs_dir }}/{{ domain | get_tld }}/cert.pem;
|
|
|
|
##
|
|
# HSTS
|
|
##
|
|
add_header Strict-Transport-Security "max-age=15552000 includeSubDomains" always;
|
|
|
|
location / {
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Ssl on;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Server $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_pass http://localhost:{{ nextcloud_port }};
|
|
|
|
client_max_body_size 500M;
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
location = /40x.html {
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
}
|
|
|
|
location /.well-known/carddav {
|
|
return 301 $scheme://$host/remote.php/dav;
|
|
}
|
|
|
|
location /.well-known/caldav {
|
|
return 301 $scheme://$host/remote.php/dav;
|
|
}
|
|
|
|
rewrite ^/.well-known/webfinger /index.php$uri redirect;
|
|
rewrite ^/.well-known/nodeinfo /index.php$uri redirect;
|
|
}
|
|
|
|
server {
|
|
if ($host = {{ nextcloud_prefix }}.{{ domain }}) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name {{ nextcloud_prefix }}.{{ domain }};
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|