worker_processes auto;
#worker_processes auto; #1.3.8和1.2.5以及之后的版本
#错误日志存放的路径
error_log logs/error.log error;
#error_log logs/error.log error;
#error_log logs/error.log error;
#允许的最大连接数
events {
worker_connections 4096;
}
http {
#文件扩展名与文件类型映射表
include mime.types;
#默认的文件类型
default_type application/octet-stream;
#长连接超时时间
keepalive_timeout 65;
server {
#监听端口
listen 8088;
location / {
root html;
}
#域名
server_name localhost;
#50x页面设置
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /live {
flv_live on; #打开HTTP播放FLV直播流功能
chunked_transfer_encoding on; #支持'Transfer-Encoding: chunked'方式回复
add_header 'Access-Control-Allow-Origin' '*'; #添加额外的HTTP头
add_header 'Access-Control-Allow-Credentials' 'true'; #添加额外的HTTP头
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias ../temp/hls;
add_header 'Cache-Control' 'no-cache'; #添加额外的HTTP头
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root html;
}
}
}
rtmp {
out_queue 4096;
out_cork 8;
max_streams 128;
timeout 15s;
drop_idle_publisher 15s;
log_interval 5s; #log模块在access.log中记录日志的间隔时间,对调试非常有用
log_size 1m; #log模块用来记录日志的缓冲区大小
server {
listen 1935;
server_name localhost;
application myapp {
live on;
gop_cache on; #打开GOP缓存,减少首屏等待时间
}
application hls {
live on;
hls on;
hls_fragment 25s;
hls_path ../temp/hls;
}
}
}