Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

2.0 KB
Raw Blame
events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # Add MIME type mapping for JavaScript modules
    types {
        application/javascript mjs;
    }

    # Gzip Settings
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/wasm;

    server {
        listen 3000;
        server_name localhost;

        # Never cache index.html, appsettings.json and service-worker.js. index.html references the
        # content hashed bundle and must always be fresh so users get the latest release.
        location ~* ^/(index\.html|appsettings\.json|service-worker\.js)$ {
            root /usr/share/nginx/html;
            add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
            add_header Pragma "no-cache";
            try_files $uri =404;
        }

        # Everything Vite emits under /assets (JS, CSS, the Rust core wasm) carries a content hash in its
        # name, so it can be cached forever: a new release references new file names.
        location ^~ /assets/ {
            root /usr/share/nginx/html;
            add_header Cache-Control "public, max-age=31536000, immutable";
            try_files $uri =404;
        }

        # Files copied from public/ (favicon, images) keep their names across releases, so the browser
        # revalidates them with the ETag.
        location ~* \.(css|js|mjs|json|woff|woff2|ttf|eot|png|jpg|jpeg|gif|ico|svg|webp|wasm)$ {
            root /usr/share/nginx/html;
            add_header Cache-Control "no-cache";
            try_files $uri =404;
        }

        # All app routes fall back to index.html.
        location / {
            root /usr/share/nginx/html;
            try_files $uri $uri/ /index.html;
        }
    }
}