88 lines
2.7 KiB
Django/Jinja
88 lines
2.7 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
# commit: {{ lookup('pipe', 'git rev-parse --short HEAD') }}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
listen 3012 ssl http2;
|
|
listen [::]:3012 ssl http2;
|
|
server_name {{ bitwarden_prefix }}.{{ domain }};
|
|
|
|
##
|
|
# SSL Settings
|
|
##
|
|
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_cert_domain }}/cert.pem;
|
|
ssl_certificate_key {{ certs_dir }}/{{ domain | get_cert_domain }}/key.pem;
|
|
ssl_certificate {{ certs_dir }}/{{ domain | get_cert_domain }}/cert.pem;
|
|
ssl_certificate_key {{ certs_dir }}/{{ domain | get_cert_domain }}/key.pem;
|
|
|
|
##
|
|
# OCSP Stapling
|
|
##
|
|
ssl_stapling on;
|
|
ssl_stapling_verify on;
|
|
resolver {{ dns_resolvers }} valid=300s;
|
|
ssl_trusted_certificate {{ certs_dir }}/{{ domain | get_cert_domain }}/cert.pem;
|
|
|
|
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://127.0.0.1:{{ bitwarden_port_web }};
|
|
|
|
client_max_body_size 128M;
|
|
}
|
|
|
|
location /notifications/hub {
|
|
proxy_pass http://127.0.0.1:{{ bitwarden_port_ws }};
|
|
proxy_http_version 1.1;
|
|
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;
|
|
}
|
|
|
|
location /notifications/hub/negotiate {
|
|
proxy_pass http://127.0.0.1:{{ bitwarden_port_web }};
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
location = /40x.html {
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
}
|
|
}
|
|
|
|
|
|
server {
|
|
if ($host = {{ bitwarden_prefix }}.{{ domain }}) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name {{ bitwarden_prefix }}.{{ domain }};
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|