Using Existing Nginx & Certificates
If Nginx and valid TLS certificates already run on your server, keep Nginx in charge of TLS termination and renewal and start only app and livekit in Chirp's Compose stack.
Ensure you have finished Host, Domain & Docker Setup, your certificate covers your Chirp subdomain, 443/TCP reaches Nginx, and 7882/UDP reaches the media host.
Step 1: Configure & Start app and livekit
On the backend host, create a permission-restricted .env file:
cd ~/chirp
touch .env && chmod 600 .env
nano .envFor Nginx running directly on the same Linux host OS, only two variables are needed. Replace CHIRP_PUBLIC_ORIGIN with your full HTTPS origin and CHIRP_RTC_NODE_IP with your media host's public IPv4 (Ctrl+O, Enter, Ctrl+X in Nano):
CHIRP_PUBLIC_ORIGIN=https://voice.example.com
CHIRP_RTC_NODE_IP=203.0.113.10Pick upstream addresses matching your Nginx placement:
| Nginx Placement | App Upstream (chirp_app_backend) | Signaling Upstream (chirp_livekit_backend) | Additional Backend .env Setting |
|---|---|---|---|
| Same-host native Nginx | 127.0.0.1:18115 | 127.0.0.1:7880 | None—ports bind loopback by default. |
| Separate host via LAN / VPN | e.g., 10.0.0.20:18115 | e.g., 10.0.0.20:7880 | Set CHIRP_HTTP_PUBLISH_IP=10.0.0.20 and restrict these TCP ports to Nginx's IP. |
| Same-host Docker container | app:18115 | livekit:7880 | Attach your Nginx container to Chirp's Compose network so DNS resolves app and livekit. |
Start app and livekit (without the https profile, so bundled Nginx stays off):
sudo docker compose config --services
sudo docker compose up -d --wait app livekit
sudo docker compose psconfig --services should print app and livekit, and both should become healthy.
If Nginx runs in another Docker container on the same host, attach it to Chirp's network (replace my-nginx with your container name). If managed by another Compose project, declare the external network cleanly so container rebuilds preserve connectivity: Persistent Proxy Network Config
sudo docker network connect chirp_default my-nginxStep 2: Configure Nginx Reverse Proxy Rules
On your Nginx host, download the reference template: Nginx Upstream Template
curl -fL https://raw.githubusercontent.com/YouZiFeiLe/Chirp/main/deploy/nginx-upstreams.example.conf -o chirp-nginx.conf &&
nano chirp-nginx.confUpdate the template:
- Point
chirp_app_backendandchirp_livekit_backendat the table values for your topology. - Replace
server_name,ssl_certificate, andssl_certificate_keywith your real domain and certificate paths. - Install into Nginx:
- New virtual host:sh
sudo install -m 0644 chirp-nginx.conf /etc/nginx/conf.d/chirp.conf - Merging into an existing HTTPS
serverblock: Keep your listener and TLS directives; moveupstream,map, andlimit_req_zoneinto the globalhttpcontext without duplicates, and merge the proxy headers andlocationblocks into your existingserverblock.
- New virtual host:
Path Routing Boundaries
/rtcand subpaths: enable WebSocket upgrade headers with long timeouts and proxy to7880/TCP./authorization/v5/: proxy toapp:18115, disable caching, and apply request rate limits./twirp/and/internal/: return404immediately so LiveKit admin endpoints stay private.- All other paths (
/): proxy toapp:18115withproxy_buffering offso Server-Sent Events (SSE) stream instantaneously.
Step 3: Test Syntax & Reload Nginx
Native Nginx on the host:
sudo nginx -t && sudo systemctl reload nginxContainerized Nginx (replace my-nginx):
sudo docker exec my-nginx nginx -t &&
sudo docker exec my-nginx nginx -s reloadOnce reloaded, proceed to Verification & First Admin.
