Nginx+rtmp构建时,localhost/stat显示为空白

首先发现stat.xsl的请求是404,发现是因为我的stat.xsl目录定位,攻略里面写的xsl目录,和我这里的目录不一致。

修改目录后,stat.xsl的请求是403 ,查看Nginx日志:

最后将xsl文件移动到Nginx的html目录下,成功请求到xsl文件,restart nginx :

 但是这个时候,xsl被不正确解析,还是看不到内容,看到控制台显示的内容是:

Resource interpreted as Stylesheet but transferred with MIME type text/xml: "http://ip:8080/stat/stat.xsl"

谷歌一下发现解决方案:https://stackoverflow.com/questions/53073274/nginx-as-rtmp-server-resource-interpreted-as-stylesheet-but-transferred-with-m

需要vi conf/mime.types

If you want stat.xsl to be type application/xml, the line in the types block should read application/xml xsl

原文地址:https://www.cnblogs.com/youmuchen/p/14592158.html