【发布时间】:2019-06-07 16:20:00
【问题描述】:
我通过 Nginx 服务器运行流媒体服务,
我只想通过 1 个域运行流(格式 m3u8)
server {
listen 80;
server_name www.mydomain.com;
if ($host != "www.mydomain.com") {
return 403;
}
}
在这里,当我测试链接时,例如:http://ip_server_stream/live/1.playlist.m3u8 在浏览器上它会在所有域上给出 Forbideen 403 错误
如果我只放了
server {
listen 80;
server_name www.mydomain.com;
}
它适用于所有域和 VLC
我只想要链接 http://ip_server_stream/live/1.playlist.m3u8 在 www.mydomain.com 上工作,而不是在其他域或 vlc 上工作
我的 nginx 版本是 1.7.5
这是我的 nginx 配置文件
这是我的配置文件,即使我有 IF 条件,它也会在所有域上给出错误 403
worker_processes 8;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1991;
allow play all;
application live {
allow play all;
live on;
hls on;
hls_nested on;
hls_path /HLS/live;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
if ($http_host != "www.mydomain.com") {
return 403;
}
location /live {
index index.html index.htm;
types {
application/vnd.apple.mpegurl m3u8;
}
alias /HLS/live;
add_header Cache-Control no-cache;
}
location / {
root html;
index index.html index.htm;
}
}
}
【问题讨论】:
标签: nginx nginx-config