Changing self hosted domain not working

I tried to switch my self hosted domain from bw.nd.online to bitwarden.nd.online but after that (following all the instructions) the server gives me a 504 Gateway Timeout.

Here is what I have done so far:

  1. I added the CNAME bitwarden into the DNS of my domain
  2. I set up NPM+ with port forwarding bitwarden.nanotekdynamic.online to my bitwarden server
  3. I modified the config.yml, global.override.env and the ngxing default.conf and replaced all bw.nd.online to bitwarden.nd.online
  4. I rebuild and restartet bitwarden
  5. Gateway Timeout while trying to access the server

Here my config.yml:

url: https://bitwarden.nd.online
generate_compose_config: true
generate_nginx_config: true
http_port: 80
https_port: 443
ssl: true
ssl_versions: 
ssl_ciphersuites: 
ssl_managed_lets_encrypt: false
ssl_certificate_path: /etc/ssl/bitwarden.ndonline/certificate.crt
ssl_key_path: /etc/ssl/bitwarden.nd.online/private.key
ssl_ca_path: 
ssl_diffie_hellman_path: /etc/ssl/bitwarden.ndonline/dhparam.pem
nginx_header_content_security_policy: 
push_notifications: true
database_docker_volume: false
real_ips: 
enable_key_connector: false
enable_scim: false
enable_built_in_ms_sql: true

Here my global.override.env:

globalSettings__baseServiceUri__vault=https://bitwarden.ndonline

Here a part of the nginx config:

server {
  listen 8080 default_server;
  listen [::]:8080 default_server;
  server_name bitwarden.nd.online;

  return 301 https://bitwarden.nd.online$request_uri;
}

server {
  listen 8443 ssl http2;
  listen [::]:8443 ssl http2;
  server_name bitwarden.nd.online;

  ssl_certificate /etc/ssl/bitwarden.nd.online/certificate.crt;
  ssl_certificate_key /etc/ssl/bitwarden.nd.online/private.key;
  ssl_session_timeout 30m;
  ssl_session_cache shared:SSL:20m;
  ssl_session_tickets off;

  # Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
  ssl_dhparam /etc/ssl/bitwarden.nd.online/dhparam.pem;

For better understanding: I have nginx proxy manger + in front of bitwarden with a wildcard lets encrypt certificate for my domain nanotekdynamic.online.

In addition, I added a lets encrypt inside bitwarden with a DNS challenge and my cloudflare API key. There is a script that copies the folder /etc/letsencrypt/live/ to /opt/bitwarden/bwdate/ssl with each renewal.

It was working fine with my old domain bw.nanotekdynamic.online.
I requested a new certificate for bitwarden.nanotekdynamic.online, copied it to /opt/bitwarden/bwdata/ssl and changed the config.yml.

I mean its not that hard to set it from “bw” to “bitwarden” and yet it’s not working.

I restarted, rebuilt, updated, pulled and composed everything in all orders. The script always says, that bitwarden is running and shows me the domain. But always a 504 error. And after returning to my old domain, still a 504 error.

I followed this manual here: Certificate Options | Bitwarden

Why do I get a 504 Gateway Timeout? I replaced all domains in the config files, I searched in every visible file and folder and double checked everything. What am I missing?

Checking the docker containers:

root@Bitwarden:/home/odin# docker container ls
CONTAINER ID   IMAGE                                       COMMAND            CREATED         STATUS                          PORTS      NAMES
b63145866499   ghcr.io/bitwarden/nginx:2025.11.0           "/entrypoint.sh"   2 minutes ago   Restarting (1) 25 seconds ago              bitwarden-nginx
d7f8d61f1d17   ghcr.io/bitwarden/admin:2025.11.0           "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-admin
99c9fd739b88   ghcr.io/bitwarden/icons:2025.11.0           "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-icons
9b9ecc060f27   ghcr.io/bitwarden/events:2025.11.0          "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-events
7fb1031e7a05   ghcr.io/bitwarden/web:2025.11.1             "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)                     bitwarden-web
65defaf75b79   ghcr.io/bitwarden/api:2025.11.0             "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-api
6b6b1f1388c5   ghcr.io/bitwarden/mssql:2025.11.0           "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)                     bitwarden-mssql
2d2dd3d00ff2   ghcr.io/bitwarden/sso:2025.11.0             "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-sso
efc9ff079e63   ghcr.io/bitwarden/notifications:2025.11.0   "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-notifications
2b933bd17ecd   ghcr.io/bitwarden/identity:2025.11.0        "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)          5000/tcp   bitwarden-identity
8e043674f465   ghcr.io/bitwarden/attachments:2025.11.0     "/entrypoint.sh"   2 minutes ago   Up 2 minutes (healthy)                     bitwarden-attachments

nginx seems to be restarting endless. But after all, the domain is now accesible. I don’t understand it. And the SSH connection is extremely laggy and slow. Not so with the old container / domain