How to use my current jitsi server with several domains

Hi people,

I have found some threads about this topic, many of them without answer, and the other with answers that doesn’t apply to my situation

What I have is a jitsi server in meet.treebes.com, now we want to have access through meet.comercia.io

Why? Because the current settings are what we need, and we don’t want to install everything from zero and remake the changes

Also, both URL have two different publics from the same company, and we want to use the same server

I have found this tutorial to set multiple domains in nginx

https://www.serverlab.ca/tutorials/linux/web-servers-linux/how-to-configure-multiple-domains-with-nginx-on-ubuntu/

But I don’t know if this way is correct for the jitsi settings

I found this thread inside this community

https://community.jitsi.org/t/same-jitsi-meet-instance-with-multiple-domain-names/17391/2

But the steps to follow are very vague, at least for me, so I wish someone could be more detailed about how to achieve this. If it’s possible, of course

Thank you in advance

Create a second nginx virtual host for the new domain and just change the part pointed in the post to use the old host.

Thank you for your help; but could you explain me, or link me to the process on how to change the part pointed in the post to use the old host? That part isn’t clear to me yet

Have you created a second virtual host for the new domain? Just copy the existing nginx config for the existing one and change to use the new domain. Does it work? If not what is the error you see in the js console logs?

Well, I couldn’t make it work

I set the second domain like this

cp /etc/nginx/sites-available/meet.treebes.com.conf meet.comercia.io.conf

Then I searched and replaced every treebes.com for comercia.io, saved and ran this

nginx -t -c meet.comercia.io
nginx: [emerg] open() "/usr/share/nginx/meet.comercia.io" failed (2: No such file or directory)
nginx: configuration file /usr/share/nginx/meet.comercia.io test failed

I thought that maybe the log could tell me more, so I ran

systemctl reload nginx
Job for nginx.service failed.

I checked what went wrong

systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-05-10 16:36:50 UTC; 1 day 23h ago
       Docs: man:nginx(8)
    Process: 13815 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=1/FAILU>
   Main PID: 2306 (nginx)
      Tasks: 2 (limit: 1131)
     Memory: 12.9M
     CGroup: /system.slice/nginx.service
             ├─ 2306 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─13576 nginx: worker process

May 12 15:15:42 meet.treebes.com systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 12 15:15:42 meet.treebes.com nginx[13266]: nginx: [emerg] "server_names_hash_bucket_size" directive is duplicate >
May 12 15:15:42 meet.treebes.com systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 12 15:15:42 meet.treebes.com systemd[1]: Reload failed for A high performance web server and a reverse proxy serv>
May 12 15:22:12 meet.treebes.com systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 12 15:22:12 meet.treebes.com systemd[1]: Reloaded A high performance web server and a reverse proxy server.
May 12 16:02:45 meet.treebes.com systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 12 16:02:45 meet.treebes.com nginx[13815]: nginx: [emerg] "server_names_hash_bucket_size" directive is duplicate >
May 12 16:02:45 meet.treebes.com systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 12 16:02:45 meet.treebes.com systemd[1]: Reload failed for A high performance web server and a reverse proxy serv>

The part “nginx: [emerg] “server_names_hash_bucket_size” directive is duplicate” made me think that it was because of the cp instead of creating a new file, so I deleted the meet.comercia.io.conf and created a new one with this inside

server {
     listen 80;
     listen [::]:80;
     server_name meet.comercia.io;

     root /usr/share/jitsi-meet;
     index index.html index.htm;

     location / {
          try_files $uri $uri/ =404;
     }
}

The root is the same of the meet.treebes.com.conf file, but when I ran the test, it failed again with the same message

I ran the command again

systemctl reload nginx

And there was no output now, so I checked status

systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-05-10 16:36:50 UTC; 1 day 23h ago
       Docs: man:nginx(8)
    Process: 13859 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCE>
   Main PID: 2306 (nginx)
      Tasks: 2 (limit: 1131)
     Memory: 11.6M
     CGroup: /system.slice/nginx.service
             ├─ 2306 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─13860 nginx: worker process

May 12 15:15:42 meet.treebes.com systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 12 15:15:42 meet.treebes.com systemd[1]: Reload failed for A high performance web server and a reverse proxy serv>
May 12 15:22:12 meet.treebes.com systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 12 15:22:12 meet.treebes.com systemd[1]: Reloaded A high performance web server and a reverse proxy server.
May 12 16:02:45 meet.treebes.com systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 12 16:02:45 meet.treebes.com nginx[13815]: nginx: [emerg] "server_names_hash_bucket_size" directive is duplicate >
May 12 16:02:45 meet.treebes.com systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 12 16:02:45 meet.treebes.com systemd[1]: Reload failed for A high performance web server and a reverse proxy serv>
May 12 16:04:03 meet.treebes.com systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 12 16:04:04 meet.treebes.com systemd[1]: Reloaded A high performance web server and a reverse proxy server.

I don’t know what the sentence “Reloading A high performance web server and a reverse proxy server.” may be; but the output is the same for both conf files

nginx -t -c meet.comercia.io
nginx: [emerg] open() "/usr/share/nginx/meet.comercia.io" failed (2: No such file or directory)
nginx: configuration file /usr/share/nginx/meet.comercia.io test failed

nginx -t -c meet.treebes.com
nginx: [emerg] open() "/usr/share/nginx/meet.treebes.com" failed (2: No such file or directory)
nginx: configuration file /usr/share/nginx/meet.treebes.com test failed

I couldn’t either create a certificate for meet.comercia.io, the output was this

certbot --nginx -d meet.comercia.io
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for meet.comercia.io
nginx: [emerg] "server_names_hash_bucket_size" directive is duplicate in /etc/nginx/sites-enabled/meet.treebes.com.conf:1
Cleaning up challenges
nginx restart failed:
b''
b''

Ah, yes, I also ran this command

ln -s /etc/nginx/sites-available/meet.comercia.io.conf /etc/nginx/sites-enabled/meet.comercia.io.conf

And retested, every prompt was the same

I also made a copy of the /etc/jitsi/meet/meet.treebes.com-config.js file as/etc/jitsi/meet/meet.comercia.io-config.js with search and replace of the text as I made above; but still nothing works for meet.comercia.io

Right now, you can enter in both urls, meet.treebes.com and meet.comercia.io; but only the first one works

nginx -t -c /etc/nginx/nginx.conf

Yes, the command prompts ok successful; why the command should be run under nginx.conf instead of the domains?

It should be the main config file