user www; error_log /var/log/nginx-rtmp/error.log; pid /run/nginx-rtmp.pid; worker_processes 1; events { worker_connections 1024; } rtmp { server { listen 1935; application live { live on; hls on; hls_path /tmp/hls; hls_fragment 10s; hls_playlist_length 20s; hls_base_url http://abc.de:1953/hls; on_publish http://abc.de:1953/auth; allow play all; wait_key on; wait_video on; } } } http { include mime.types; default_type application/octet-stream; sendfile on; init_by_lua_file /etc/nginx-rtmp/auth.lua; server { server_name abc.de; listen 1953; location /hls { root /tmp; add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } } location /auth { content_by_lua_block { return auth() } } } }