No KYC VPS
TutorialsNov 13, 20267 min readBy the No KYC VPS team

How to Self-Host Vaultwarden (Bitwarden) on a VPS With Docker

Run your own Vaultwarden password server on a VPS with Docker Compose and Caddy for automatic HTTPS: setup, closing signups, backups and updates.

Vaultwarden is a lightweight server compatible with the Bitwarden apps. You keep the encrypted vault on your own server. It needs very little: a small VPS with 1 GB of RAM is enough.

Before you start

docker-compose.yml

services:
  vaultwarden:
    image: vaultwarden/server:latest
    restart: unless-stopped
    environment:
      DOMAIN: "https://vault.example.com"
      SIGNUPS_ALLOWED: "true"
    volumes:
      - ./vw-data:/data

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports: ["80:80", "443:443"]
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data

volumes:
  caddy_data:

Caddyfile

vault.example.com {
    reverse_proxy vaultwarden:80
}

Caddy gets and renews the TLS certificate by itself. Start everything with docker compose up -d.

After creating your account

  1. Open https://vault.example.com and register your account.
  2. Change SIGNUPS_ALLOWED to "false" and run docker compose up -d so nobody else can register.
  3. Turn on two-step login in your account settings.

Hardening checklist

  • Turn off open sign-ups after you register, as shown above. Use invitations only if you want to add other people.
  • Keep the admin page off unless you need it. If you enable it, use a long random token and remove it when you are done.
  • Allow only ports 22, 80 and 443 in the firewall. See secure a new VPS in 15 minutes.
  • Pin the image to a version number instead of latest if you prefer to update on purpose, and read the release notes before each upgrade.

Connect the apps

In the Bitwarden browser extension or phone app, open the login screen, choose the self-hosted option and enter your server address, for example https://vault.example.com. Then log in with the account you created.

Test your restore

A backup is only useful if you have restored it once. Copy the vw-data folder to a spare machine, start the same compose file and check that you can log in and see your items. Do this before you depend on the vault.

Also keep an encrypted export of your vault somewhere offline as a second copy.

Backups and updates

  • Back up the vw-data folder regularly. It holds the database and attachments. See how to back up a VPS.
  • Update with docker compose pull && docker compose up -d.

More on the product page: self-hosted Vaultwarden.

Frequently asked questions

Is Vaultwarden compatible with Bitwarden apps?

Yes. The Bitwarden browser extensions, desktop and mobile apps work with a Vaultwarden server.

Why do I need HTTPS?

The apps refuse to connect over plain HTTP. Caddy handles certificates automatically.

How do I stop other people registering?

Set SIGNUPS_ALLOWED to false after you create your account.

What should I back up?

The vw-data folder, which holds the database and attachments.

How much does it cost to run Vaultwarden?

Very little. It runs on a VPS with 1 GB of RAM, so the cost is a small monthly plan plus a domain name.

Is Vaultwarden the same as Bitwarden?

No. It is an unofficial, community-built server that works with the official Bitwarden apps.

What happens if my server goes down?

The apps usually keep a local copy of your vault, so you can still read existing items, but you cannot sync until the server is back. Keep backups so that you can restore it.