server {
    listen 8090;
    
    location /trilium/ {
        rewrite ^/trilium(/.*)$ $1 break;
        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_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://host.docker.internal:8082; # change it to a different port if non-default is used
        proxy_cookie_path / /trilium/;
        proxy_read_timeout 90;
    }
}