2026-04-01 23:54:15 -07:00
# @companion nginx configuration
## Installation
```bash
2026-04-09 20:10:04 -07:00
# Generate wildcard cert (one-time):
mkcert -install
mkcert -cert-file /etc/nginx/certs/local/_wildcard.quinn.apricot.local+1.pem \
-key-file /etc/nginx/certs/local/_wildcard.quinn.apricot.local+1-key.pem \
"*.quinn.apricot.local" quinn.apricot.local
# Add to /etc/hosts (if not already present):
echo "127.0.0.1 ai.quinn.apricot.local" | sudo tee -a /etc/hosts
2026-04-01 23:54:15 -07:00
# Symlink into nginx sites-enabled:
2026-04-09 20:10:04 -07:00
sudo ln -sf "$(pwd)/ai.quinn.apricot.local.conf" /etc/nginx/sites-enabled/ai.quinn.apricot.local.conf
# Remove old config if present:
sudo rm -f /etc/nginx/sites-enabled/companion.lilith.apricot.local.conf
2026-04-01 23:54:15 -07:00
# Verify config and reload:
sudo nginx -t & & sudo systemctl reload nginx
```
2026-04-09 20:10:04 -07:00
## Domain
2026-04-01 23:54:15 -07:00
| Domain | Upstream | Port |
|--------|----------|------|
2026-04-09 20:10:04 -07:00
| `ai.quinn.apricot.local` | companion-api (NestJS) + companion-web (Vite) | 3850 / 5850 |
Single domain mirrors production (`ai.transquinnftw.com` ). API paths (`/voice/` , `/chat` , `/session` , `/health` , `/api/` ) route to companion-api on :3850. Everything else routes to the Vite dev server on :5850.
2026-04-01 23:54:15 -07:00
## SSL Certificates
2026-04-09 20:10:04 -07:00
Uses wildcard cert for `*.quinn.apricot.local` :
2026-04-01 23:54:15 -07:00
```
2026-04-09 20:10:04 -07:00
/etc/nginx/certs/local/_wildcard.quinn.apricot.local+1.pem
/etc/nginx/certs/local/_wildcard.quinn.apricot.local+1-key.pem
2026-04-01 23:54:15 -07:00
```
## Voice WebSocket Notes
- `proxy_buffering off` is mandatory for the `/voice/` location
- PCM binary frames must not be buffered — any buffering causes audio glitches
- `proxy_read_timeout 3600s` supports 1-hour voice sessions
- The `$connection_upgrade` map must be in the nginx `http` context (nginx.conf)