ansible/roles/vaultwarden/templates/vhost.j2

45 lines
970 B
Plaintext
Raw Normal View History

2022-09-03 12:21:08 +02:00
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name {{ vaultwarden_domain }};
location /.well-known/acme-challenge {
default_type "text/plain";
alias /var/www/acme-challenge;
}
location / {
return 301 https://{{ vaultwarden_domain }}$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ vaultwarden_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ vaultwarden_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ vaultwarden_domain }}.crt;
# set max upload size
client_max_body_size 8M;
location / {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
2022-09-03 12:21:08 +02:00
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}