47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' "";
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name vaultwarden.example.com;
|
|
|
|
# Redirect to https
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name vaultwarden.example.com;
|
|
|
|
client_max_body_size 128M;
|
|
|
|
# TLS
|
|
# Please generate a secure TLS configuration with the Mozilla SSL Configuration Generator: https://ssl-config.mozilla.org/
|
|
ssl_certificate /etc/ssl/certs/vaultwarden-fullchain.crt;
|
|
ssl_certificate_key /etc/ssl/private/vaultwarden.key
|
|
|
|
# HSTS
|
|
add_header Strict-Transport-Security "max-age=63072000; preload";
|
|
|
|
# Reverse Proxy
|
|
resolver 127.0.0.1 valid=300s;
|
|
resolver_timeout 5s;
|
|
|
|
location / {
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
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;
|
|
proxy_pass http://127.0.0.1:8000;
|
|
}
|
|
}
|