Change domain name to an already existing self hosting Jitsi Meet server

I have a self hosting Jitsi Meet server. It contains also the source, and I made many custom configurations and compilation.
I need to change the domain name.
Any idea how to do that?
Thx
I. Lesher

All xmpp part uses a virtual domain, you can leave that. If you are changing just the DNS make sure you handle it in nginx config and just change the remote host for the bosh connection to be the original one here: jitsi-meet/jitsi-meet.example at 7c8692902c8f693f2fb876680ad073216226ced0 · jitsi/jitsi-meet · GitHub
So you just need to edit the nginx connection, the two server_name jitsi-meet.example.com; and the remote host of the bosh connection.
And maybe the bridge config for the websocket.

Thx
I couldn’t track it yet. Can you indicate the exact file name which should be edited?
Thx

This is in /etc/nginx/sites-available/…

Thx Damencho,
I believe I managed to have the file but still all my modifications didn’t work
The current DNS is jitsi2.triplebit.com- and it works fine.
It should be modified into jitsi3.triplebit.com(just 3 instead of 2).
Can you make the corrections in the file for me?
Thx
I. Lesher

#!!! I remarked it in 15.8.2021 server_names_hash_bucket_size 64;

types {

nginx’s default mime.types doesn’t include a mapping for wasm

application/wasm     wasm;

}
server {
if ($host = jitsi2.triplebit.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;
server_name jitsi2.triplebit.com;

location ^~ /.well-known/acme-challenge/ {
    default_type "text/plain";
    root         /srv/jitsi-meet;
}
location = /.well-known/acme-challenge/ {
    return 404;
}
location / {
    return 301 https://$host$request_uri;
}

}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name jitsi2.triplebit.com;

# Mozilla Guideline v5.4, nginx 1.17.7, OpenSSL 1.1.1d, intermediate configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;  # about 40000 sessions
ssl_session_tickets off;

add_header Strict-Transport-Security "max-age=63072000" always;
set $prefix "";
ssl_certificate /etc/letsencrypt/live/jitsi2.triplebit.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/jitsi2.triplebit.com/privkey.pem; # managed by Certbot

root /srv/jitsi-meet;

# ssi on with javascript for multidomain variables in config.js
ssi on;
ssi_types application/x-javascript application/javascript;

index index.html index.htm;
error_page 404 /static/404.html;

gzip on;
gzip_types text/plain text/css application/javascript application/json image/x-icon application/octet-stream application/wasm;
gzip_vary on;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 512;

location = /external_api.js {
    alias /srv/jitsi-meet/libs/external_api.min.js;
}

# ensure all static content can always be found first
location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$
{
    add_header 'Access-Control-Allow-Origin' '*';
    alias /srv/jitsi-meet/$1/$2;

    # cache all versioned files
    if ($arg_v) {
        expires 1y;
    }
}

# BOSH
location = /http-bind {
    proxy_pass http://127.0.0.1:5280/http-bind?prefix=$prefix&$args;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $http_host;
}

# xmpp websockets
location = /xmpp-websocket {
    proxy_pass http://127.0.0.1:5280/xmpp-websocket?prefix=$prefix&$args;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    tcp_nodelay on;
}

# colibri (JVB) websockets for jvb1
location ~ ^/colibri-ws/default-id/(.*) {
    proxy_pass http://127.0.0.1:9090/colibri-ws/default-id/$1$is_args$args;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    tcp_nodelay on;
}

# load test minimal client, uncomment when used
#location ~ ^/_load-test/([^/?&:'"]+)$ {
#    rewrite ^/_load-test/(.*)$ /load-test/index.html break;
#}
#location ~ ^/_load-test/libs/(.*)$ {
#    add_header 'Access-Control-Allow-Origin' '*';
#    alias /usr/share/jitsi-meet/load-test/libs/$1;
#}

location ~ ^/([^/?&:'"]+)$ {
    try_files $uri @root_path;
}

location @root_path {
    rewrite ^/(.*)$ / break;
}

# BOSH for subdomains
location ~ ^/([^/?&:'"]+)/http-bind {
    set $subdomain "$1.";
    set $subdir "$1/";
    set $prefix "$1";

    rewrite ^/(.*)$ /http-bind;
}

# websockets for subdomains
location ~ ^/([^/?&:'"]+)/xmpp-websocket {
    set $subdomain "$1.";
    set $subdir "$1/";
    set $prefix "$1";

    rewrite ^/(.*)$ /xmpp-websocket;
}

# Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to /
location ~ ^/([^/?&:'"]+)/(.*)$ {
    set $subdomain "$1.";
    set $subdir "$1/";
    rewrite ^/([^/?&:'"]+)/(.*)$ /$2;
}

}

Change this to jitsi2.triplebit.com

This to have proxy_set_header Host jitsi3.triplebit.com;

Same here proxy_set_header Host jitsi3.triplebit.com;

For my deployments, we usually build images with Jitsi installed using generic internal hostname and on deploy update configs in a handful of places to match the deployment host. This gives us a clear distinction between the XMPP domain and the Jitsi Meet deployment hostname. But I digress. The point is the changes we make on deployment is essentially the same as changing the domain name of an existing Jitsi Meet deployment.

If I remember correctly, here’s the list of changes we make to achieve this:

  1. In /etc/nginx/sites-available/OLD.DOMAIN.conf, for each server block:
    #server_name OLD_DOMAIN;
    server_name NEW_DOMAIN;
    
  2. In /etc/jitsi/meet/OLD.DOMAIN-config.js, update bosh and websocket URLs to automatically inherit http_host and subdir:
    // bosh: '//OLD.DOMAIN/http-bind',
    bosh: '//<!--# echo var="http_host" -->/<!--# echo var="subdir" default="" -->http-bind',
    
    // websocket: 'wss://OLD.DOMAIN/xmpp-websocket',
    websocket: 'wss://<!--# echo var="http_host" -->/<!--# echo var="subdir" default="" -->xmpp-websocket',
    
  3. In /etc/jitsi/videobridge/jvb.conf, under websockets block:
    # domain = "OLD.DOMAIN:443"
    domain = "NEW_DOMAIN:443"
    
  4. If you use jibri, you will also need to tell it to use the new domain name to connect. Otherwise it defaults to the XMPP domain which is domain you used during the Jitsi install. IIRC, this can be done by setting base-url in jibri.api.environments. See jibri/example_xmpp_envs.conf at ddb146cc0a1800347442e2ce09e6b75fb27303d4 · jitsi/jibri · GitHub

Nothing changes for prosody config.

Don’t forget to update SSL certs referenced by Nginx to match the new domain name.

You can find all related places using

grep -i "your-old-domain" /etc -R
find /etc -name "*your-old-domain*"

grep -i "your-old-domain" /var/lib -R
find /var/lib -name "*your-old-domain*"

Thx emrah, shawn, damench,
I will try today to implement your advices…
I really appreciate your help
Regards
I. Lesher