veza/infra/nginx-rtmp/nginx.conf
senke 73eca4f6ad feat: backend, stream server & infra improvements
Backend (Go):
- Config: CORS, RabbitMQ, rate limit, main config updates
- Routes: core, distribution, tracks routing changes
- Middleware: rate limiter, endpoint limiter, response cache hardening
- Handlers: distribution, search handler fixes
- Workers: job worker improvements
- Upload validator and logging config additions
- New migrations: products, orders, performance indexes
- Seed tooling and data

Stream Server (Rust):
- Audio processing, config, routes, simple stream server updates
- Dockerfile improvements

Infrastructure:
- docker-compose.yml updates
- nginx-rtmp config changes
- Makefile improvements (config, dev, high, infra)
- Root package.json and lock file updates
- .env.example updates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:36:06 +01:00

58 lines
1.6 KiB
Nginx Configuration File

# v0.10.6 F471: Nginx-RTMP for live stream ingest
# OBS connects to rtmp://host:1935/live with stream key = stream_key from API
worker_processes 1;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
# HLS output for playback (2s segments)
hls on;
hls_path /tmp/hls;
hls_fragment 2s;
hls_playlist_length 6s;
hls_cleanup on;
hls_nested on;
# Callbacks to backend for stream_key validation and is_live updates
# Params: name=stream_key, addr, app, etc.
on_publish http://backend-api:18080/api/v1/live/callback/publish;
on_publish_done http://backend-api:18080/api/v1/live/callback/publish_done;
}
}
}
# HTTP server for HLS playback and stat
http {
server {
listen 8080;
server_name localhost;
# HLS playlists and segments: /live/{stream_key}/playlist.m3u8 -> /tmp/hls/{stream_key}/
location /live/ {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias /tmp/hls/;
add_header Cache-Control no-cache;
# SECURITY(REM-022): Restrict CORS to application origins instead of wildcard
add_header Access-Control-Allow-Origin "$http_origin" always;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /etc/nginx;
}
}
}