我正在尝试将nginx的stats作为rtmp服务器,下面是我的配置文件,但我在http://ip:8080/stat.xsl上得到了403 (也尝试了http://ip/stat.xsl提供404,http://ip:8080/stat/stat.xsl给出一个空白页,没有错误)。
我从这里复制了这些设置:https://github.com/arut/nginx-rtmp-module
不知道怎么回事..。
我需要找到一种从rtmp服务器中提取统计数据的方法,或者至少找到一种获得活动连接的方法。
谢谢。
rtmp {
server {
listen 1935;
chunk_size 4000;
allow play all;
application live {
allow play all;
live on;
hls on;
hls_nested on;
hls_path /HLS/hls;
hls_fragment 10s;
record off;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 8080;
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
}
alias /HLS/hls;
add_header Cache-Control no-cache;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /root/nginx-rtmp-module-dev/stat.xsl/;
}
}
}更新:当我访问http://IP:8080/stat/stat.xsl时,我在console中看到了这个,我认为这是相关的:Resource interpreted as Stylesheet but transferred with MIME type text/xml: http://IP:8080/stat/stat.xsl
发布于 2018-10-30 15:55:32
然后检查/root/nginx-rtmp-module-dev/stat.xsl/stat.xsl及其父目录的权限。您将发现web服务器无法读取/root,因此您将得到一个403错误。
若要解决此问题,请将文件移动到适当的位置,并将nginx配置更改为匹配。
发布于 2019-05-17 11:03:33
我认为问题已经解决了。但我一直在努力解决同样的问题,并找到了解决方案,即我们需要使用路由url来访问统计数据,而不是使用文件名。例如: example.com/stat,然后stat将重定向到实际页面。在这里,我们可以看到与RTMP统计表。
发布于 2019-08-05 20:07:12
将nginx-rtmp-stat.xsl复制到nginx html文件夹。
将stat.xsl路径设置为nginx-rtmp html文件夹
location /stat.xsl {
root /path-to-nginx-rtmp-html-folder/;
}然后去http://yourip/stat
https://serverfault.com/questions/937903
复制相似问题