
(封面图源Jitsi官网)
TL;DR
最近有需要多设备同时音视频串流的需求,但市场上的会议软件对这类需求的限制有点多,看了一圈,决定搭一个jitsi meet。这里我们使用docker部署,不部署到裸机上。
开始部署
为docker compose设置代理
假设你的服务器127.0.0.1:1145有一个http代理服务,编辑/etc/systemd/system/docker.service.d/http-proxy.conf文件,写入如下内容:
1 2 3 4
| [Service] Environment="HTTP_PROXY=http://127.0.0.1:1145" Environment="HTTPS_PROXY=http://127.0.0.1:1145" Environment="NO_PROXY=localhost,127.0.0.1"
|
准备文件
⚠️注意:
请确保你有一个域名及其证书,不然会出现无法连接到服务的情况。
假设你的域名是example.your.domain。
下载最新构建并将其解压:
1 2
| wget $(wget -q -O - https://api.github.com/repos/jitsi/docker-jitsi-meet/releases/latest | grep zip | cut -d\" -f4) unzip <filename>
|
进入解压好的文件夹,把配置文件复制一份:
然后编辑配置文件.env,按需做出更改,我的更改如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| # 访问端口,http端口的访问会被自动重定向到https HTTP_PORT=8000 HTTPS_PORT=8443 # 系统时区 TZ=Asia/Shanghai # 你的会议访问入口,就是你从客户端浏览器访问网页的地址,填入你的域名 PUBLIC_URL=https://example.your.domain:10086 # 后端JVM内存限制 JICOFO_MAX_MEMORY=3072m VIDEOBRIDGE_MAX_MEMORY=3072m # 启用主持人密码 ENABLE_AUTH=1 # 允许访客,如果主持人密码和允许访客都启用了,访客会一直在等待界面直到主持人登陆会议 ENABLE_GUESTS=1 # 主持人密码认证方式 AUTH_TYPE=internal # 启用websocket连接 ENABLE_XMPP_WEBSOCKET=0
|
然后生成一下其他的密钥并创建配置文件夹:
1 2
| ./gen-passwords.sh mkdir -p ~/.jitsi-meet-cfg/{web,transcripts,prosody/config,prosody/prosody-plugins-custom,jicofo,jvb,jigasi,jibri}
|
接下来用nginx反代到HTTPS_PORT,注意是HTTPS不是HTTP,并添加你自己的域名证书。
用docker开始部署!
添加和删除主持人
首先要进入jitsi-docker-main-prosody容器的命令行:
⚠️注意:
这里容器具体名字还需要二次确认,因为在实际部署的时候容器后面可能会出现随机数字,如-1、_1之类的。
1
| docker exec -it jitsi-docker-main-prosody /bin/bash
|
添加主持人:
1
| prosodyctl --config /config/prosody.cfg.lua register admin meet.jitsi mySecurePass123
|
删除主持人:
1
| prosodyctl --config /config/prosody.cfg.lua unregister admin meet.jitsi
|
查看所有的主持人:
1
| find /config/data/meet%2ejitsi/accounts -type f -exec basename {} .dat \;
|
如果你是纯ip部署,没有域名
这会让你的服务器在8444端口启动jitsi服务,在安卓app和电脑浏览器里都使用https://YOUR_PUBLIC_IP:8444即可使用。
你需要将nginx反代到你的http端口(注意不是https),这是示例配置文件:
1 2 3 4 5 6 7 8 9 10 11 12 13
| server { listen 8444 ssl; server_name YOUR_PUBLIC_IP;
ssl_certificate /path/to/cert/fullchain.pem; ssl_certificate_key /path/to/cert/privkey.pem;
location / { proxy_pass http://DOCKER_HOST_IP:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
|
注意⚠️:
你需要将DOCKER_HOST_IP替换成你docker的网桥ip,YOUR_PUBLIC_IP换成你服务器的公网ip。
注意⚠️:
记得放通8444和80端口,acme.sh续签会用80端口,jitsi会用8444端口。
自动续签ip证书
2025年12月中旬起,Let's Encrypt支持签发ip证书了,不过单证书最高6天。所以我们要用acme.sh配合crontab进行自动续签。
安装依赖:
1
| apk add vim curl bash cronie openssl ca-certificates nginx
|
写入nginx配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| server { listen 80;
root /path/to/webroot; index index.html;
# 静态文件服务 location / { try_files $uri $uri/ =404;
# 添加缓存控制头(可选) expires 1d; add_header Cache-Control "public, immutable"; }
# 禁用favicon.ico的日志记录(可选) location = /favicon.ico { log_not_found off; access_log off; }
# 禁止访问隐藏文件 #location ~ /\. { # deny all; # access_log off; # log_not_found off; #}
# 错误页面配置 error_page 404 /404.html; location = /404.html { internal; } }
|
安装acme.sh
在你的服务器上运行这段命令,但千万记得把邮箱换成你自己的。
1
| curl https://get.acme.sh | sh -s email=my@example.com
|
⚠️注意:
记得把$HOME/.acme.sh目录加入你的PATH。
写入renew.sh,这段脚本会单次签发证书并把证书写入你的nginx目录:
1 2 3 4
| #!/bin/sh export PATH="$HOME/.acme.sh:$PATH"
acme.sh --issue -d YOUR_PUBLIC_IP -w /path/to/webroot --server letsencrypt --certificate-profile shortlived --days 6 --cert-file /path/to/cert/cert.pem --key-file /path/to/cert/privkey.pem --fullchain-file /path/to/cert/fullchain.pem --reloadcmd "nginx -s stop & sleep 10s && nginx" --force
|
然后运行crontab -e编辑定时任务,添加以下行:
1
| 0 2 */5 * * /bin/sh /root/renew.sh >> /root/renew.log
|