我在Nginx中需要这样的东西:
为了能够看到m3u流,用户需要像这样进行身份验证
HTTP://stream.com/livestream/stream.m3u?key=xxxxxxxxxx
并通过一个PHP文件进行身份验证,该文件验证用户是否可以看到m3u流
我希望你能帮助我:)
server {
listen 80;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
location /livestream {
# Serve HLS fragments
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
# if ($request_method = 'OPTIONS') {
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain charset=UTF-8';
# add_header 'Content-Length' 0;
# return 204;
# }
root /;
add_header Cache-Control no-cache;
}
}
}
rtmp {
server {
listen 1935;
application livestream {
live on;
hls on;
hls_path /livestream;
}
}
}```