Field guide
Self-hosting MiroTalk for private video calls
Video calls do not have to go through somebody else's company. MiroTalk is a WebRTC meeting server you can run on a small VM, and for an office of twenty people it needs very little hardware.
Most install guides stop after the container starts. That gets you something that works on your LAN and fails the moment a real person dials in from outside — so this one goes all the way through HTTPS and TURN, which is where the actual work is.
What you need before starting
- A server or VM with a public IP. 1 vCPU and 1 GB RAM is enough to start.
- A domain name you control, with an A record pointing at that IP.
- Root access over SSH.
- Ports open: 80 and 443 TCP, 3478 TCP and UDP, and a UDP range such as 49160-49200 for relayed media.
1Prepare the server
Update the base system first. On a fresh VM this also pulls in current security patches:
apt update && apt upgrade -y
Set the hostname so logs and certificates line up with the name people will type:
hostnamectl set-hostname meet.example.com
Check the DNS record actually resolves to this machine before going further. If this returns nothing, or the wrong address, stop here — the certificate step later will fail and the error it gives is unhelpful:
dig +short meet.example.com
2Install Docker
Use the official convenience script. It adds the correct repository for the distribution rather than installing whatever ancient version is in the default repos:
curl -fsSL https://get.docker.com | sh
Confirm the daemon is running:
docker --version && systemctl is-active docker
You should see a version string followed by active. If it says inactive, start it and enable it at boot:
systemctl enable --now docker
3Run MiroTalk
Pull and start the container. Port 3000 inside the container is published on localhost only — nothing should reach it from outside except through the proxy you set up in step 5:
docker run -d \
--name mirotalk \
--restart unless-stopped \
-p 127.0.0.1:3000:3000 \
mirotalk/p2p:latest
Check it started and stayed running:
docker ps --filter name=mirotalk
If the container is missing from that list it exited. Read why:
docker logs mirotalk --tail 50
4Test it locally
Before adding the proxy, confirm the application itself answers. From the server:
curl -I http://127.0.0.1:3000
A 200 OK means MiroTalk is healthy and the remaining work is all networking. Anything else and the problem is in the container, so fix that first — debugging a proxy in front of a broken application wastes an afternoon.
5Put Nginx in front with HTTPS
Browsers refuse camera and microphone access on an insecure origin. Anything other than localhost must be HTTPS, or the call never starts and the console error rarely says why.
Install Nginx and the Certbot plugin:
apt install -y nginx python3-certbot-nginx
Create the site configuration:
nano /etc/nginx/sites-available/mirotalk
Paste this, changing the domain to yours. The Upgrade headers are not optional — MiroTalk signalling runs over WebSockets, and without them the page loads but no one can ever join a room:
server {
listen 80;
server_name meet.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
}
Enable the site and remove the default one so it cannot shadow yours:
ln -s /etc/nginx/sites-available/mirotalk /etc/nginx/sites-enabled/
rm -f /etc/nginx/sites-enabled/default
Test the configuration before reloading. Nginx will refuse to start on a syntax error and take the site down with it:
nginx -t && systemctl reload nginx
Now get a certificate. Certbot edits the config in place to add the TLS block and the redirect:
certbot --nginx -d meet.example.com
Renewal is installed as a timer automatically. Confirm it works rather than finding out in ninety days:
certbot renew --dry-run
6Install coturn
This is the step that separates a demo from something usable.
WebRTC first tries to connect the two browsers directly. Behind office NAT, on mobile data, or on a corporate network that blocks UDP, that direct path often does not exist. The call then connects, rings, and stays black. TURN relays the media when the direct path fails.
apt install -y coturn
Enable the service — it ships disabled:
sed -i 's/^#TURNSERVER_ENABLED/TURNSERVER_ENABLED/' /etc/default/coturn
Generate a password and keep it somewhere safe. The same value goes in coturn's config and in MiroTalk's environment, in step 8:
openssl rand -hex 32
Open the configuration:
nano /etc/turnserver.conf
Replace the contents with this, substituting your domain, your public IP and the password you just generated. This uses a fixed username and password, so the values in step 8 must match:
listening-port=3478
fingerprint
lt-cred-mech
user=mirotalk:PASTE_YOUR_PASSWORD_HERE
realm=meet.example.com
# The public address clients should be told to send media to.
external-ip=YOUR_PUBLIC_IP
# Keep the relay range small and open exactly this range on the firewall.
min-port=49160
max-port=49200
# Do not relay to internal addresses - an open relay will be found and abused.
no-multicast-peers
denied-peer-ip=10.0.0.0-10.255.255.255
denied-peer-ip=172.16.0.0-172.31.255.255
denied-peer-ip=192.168.0.0-192.168.255.255
log-file=/var/log/turnserver.log
Start it:
systemctl enable --now coturn && systemctl status coturn --no-pager
7Open the firewall
SSH first, always. Enabling the firewall without it locks you out, and the only way back in is the provider's console. Then only the ports actually needed:
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 3478/tcp
ufw allow 3478/udp
ufw allow 49160:49200/udp
ufw --force enable
Check what ended up open:
ufw status numbered
8Point MiroTalk at your TURN server
MiroTalk reads its ICE configuration from environment variables. Recreate the container with them set — changing environment variables needs a new container, not a restart:
docker rm -f mirotalk
docker run -d \
--name mirotalk \
--restart unless-stopped \
-p 127.0.0.1:3000:3000 \
-e TURN_ENABLED=true \
-e TURN_URLS=turn:meet.example.com:3478 \
-e TURN_USERNAME=mirotalk \
-e TURN_PASSWORD=PASTE_YOUR_PASSWORD_HERE \
mirotalk/p2p:latest
9Verify it properly
Test from outside the building, on mobile data, with Wi-Fi turned off on the phone. A call between two machines on the same LAN proves nothing: that path works even when TURN is completely misconfigured.
Confirm the relay itself is reachable and handing out credentials. Open the WebRTC test page, paste your TURN URL, username and password, and press gather:
https://icetest.info/
You want to see at least one candidate of type relay. If only host and srflx candidates appear, coturn is not being reached — check the firewall and the external-ip value.
Watch the log live while you place a test call:
tail -f /var/log/turnserver.log
Allocation lines appearing as the call connects means relaying is working.
10Keep it running
Updating is a pull and a recreate. Containers are disposable; nothing of yours lives inside:
docker pull mirotalk/p2p:latest && docker rm -f mirotalk
Then run the docker run command from step 8 again.
Check on it after a reboot to confirm both services come back by themselves:
systemctl is-enabled coturn docker && docker ps --filter name=mirotalk
Troubleshooting
Page loads but the camera never turns on. Not HTTPS, or a certificate the browser does not trust. Check the padlock.
Two people join, both see black. TURN is not working. Go back to step 9 and check for a relay candidate.
Works on the LAN, fails outside. Same cause. LAN calls connect peer-to-peer and never touch TURN.
Nobody can join a room at all. The WebSocket upgrade headers are missing from the Nginx config. Check step 5.
Container restarts in a loop. docker logs mirotalk --tail 50 will say why. Usually a port conflict or a malformed environment variable.
Want this set up for you? Get in touch and describe the setup — how many people, whether calls come from outside the building, and what hardware is available.