Migrate Self-Hosted To New Server

I need to copy my current self-hosted install to a newer Linux system.

I have exported the vault and have a complete copy of the bwdata directory.

What’s the procedure please?

Hello @plittlefield,
it depends on what you want to do. If you are the only person using the instance, you can start there from scratch, create an account and import your data. But if you have also other users, then there are several options:

  1. In a VM environment where you have only bitwarden hosted, you can clone it.
  2. Or you can copy the predefined volumes in docker-compose file, usually you will need to copy the standard bwdata folder to the new instance and continue from there.

hope this helps :slight_smile:

OK, I have successfully copied my existing self-hosted Bitwarden instance to a newer Linux system.

  1. Follow the guide to set up a fresh installation on new server.
  2. Stop Bitwarden on new server.
  3. Stop Bitwarden on old server.
  4. Delete the contents of the /bwdata/ directory on new server.
  5. Copy across the old Bitwarden /bwdata/ directory to the new server.
  6. Start Bitwarden on new server.
  7. Test.

Job, done.

My next problem?

I need a standalone version of NginX running at the same time, to be able to host web sites - but ofcourse ports 80 and 443 are already taken.


Hello @plittlefield,
you need to change the docker-compose.yml file of bitwarden. It should be under bwdata/docker.

  - "80:8080"
  - "443:8443"

The left side (ports 80, 443) should be changed to the desired ones. Example:

  - "8080:8080"
  - "8443:8443"

then adapt nginx approprietly.

Hope this helps :slight_smile:

Perfect, thanks!

I ran the ‘./bitwarden.sh update’ command to update the docket compose file and it worked a treat.

I then logged out of my various apps, browser extensions etc., then changed the vault location to add :8443 at the end.


Bitwarden rocks.

Thanks :slight_smile:

Writing because maybe it is gonna help someone.
I basically installed Bitwarden on new server, copied latest backup from the old server and followed the tutorial to restore a backup and restarted it.

That’s it

@Radek_Suski thanks for this helpful update.

Can I check about the full domain name (FQDN) that is asked for during a new install (on target docker host)? Do you use a dummy one while installing, which is replaced by whatever is in the ./bwdata directory? Or is the final FQDN required, and time-sensitive about how this is swapped over? i.e. shut down the existing containers, change DNS records, then do the new install?

In my configuration, the existing Bitwarden instance has a FQDN AName DNS record pointing the docker host’s external IP.

The source docker host is using JWilder’s “Nginx-proxy” setup with LetsEncrypt companion container. The target docker host uses the jc21/nginx-proxy-manager container instead (it does not auto-detect new containers, but is configured once the new containers are running).