#user nobody; worker_processes 1; daemon off; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } # 切换自动推送(多 worker 直播流)模式。默认为 off rtmp_auto_push on; # 当 worker 被干掉时设置自动推送连接超时时间。默认为 100 毫秒 rtmp_auto_push_reconnect 1s; rtmp { server { listen 1935; chunk_size 4000; # 直播流配置 application live { live on; #为 rtmp 引擎设置最大连接数。默认为 off max_connections 1024; # default recorder record all; record_path /home/xiaoxia/biye/ffmpeg/web/rec; recorder audio { record audio; record_suffix -%d-%b-%y-%T.flv; } recorder chunked { record all; record_interval 15s; record_path /home/xiaoxia/biye/ffmpeg/web/rec/chunked; } } # 点播配置 application video { play /home/xiaoxia/biye/ffmpeg/web; } application audio { play /home/xiaoxia/biye/ffmpeg/web; } # HLS # HLS requires libavformat & should be configured as a separate # NGINX module in addition to nginx-rtmp-module: # ./configure … –add-module=/path/to/nginx-rtmp-module/hls … # For HLS to work please create a directory in tmpfs (/tmp/app here) # for the fragments. The directory contents is served via HTTP (see # http{} section in config) # # Incoming stream must be in H264/AAC/MP3. For iPhones use baseline H264 # profile (see ffmpeg example). # This example creates RTMP stream from movie ready for HLS: # # ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264 # -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 # -f flv rtmp://localhost:1935/hls/movie # # If you need to transcode live stream use ‘exec’ feature. # application hls { hls on; hls_path /home/xiaoxia/biye/ffmpeg/web/hls; hls_fragment 10s; } } } http { include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8080; server_name tx.evanxia.com; root /home/xiaoxia/biye/ffmpeg/web; limit_rate_after 5m; #在flv视频文件下载了5M以后开始限速 limit_rate 100k; #速度限制为100K charset utf-8; location / { index index.html index.htm; } #将.flv文件指向flv模块 location ~ \.flv$ { flv; } location ~ \.mp4$ { mp4; } location /hls$ { # Serve HLS fragments alias /home/xiaoxia/biye/ffmpeg/web/hls; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }