arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.48k stars 3.52k forks source link

Issue with stat.xsl - Resource interpreted as Stylesheet but transferred with MIME type text/xml: #1327

Open gavin2812 opened 6 years ago

gavin2812 commented 6 years ago

Hello,

Not a bug, but I'm having an issue getting the stat.xsl page to work, i'm getting a blank page on http://IP:8080/stat/stat.xsl and if I go into Chrome console, I see this: stat.xsl:2 Resource interpreted as Stylesheet but transferred with MIME type text/xml: "http://IP:8080/stat/stat.xsl".

I've tried quite a bit to resolve, but cannot get the page to display the stats. I'm sure it is more an issue regarding displaying the correct mime type, rather than an issue with the rtmp module, but I'm hoping someone can help.

This is my (heavily) edited nginx.conf file, as you can see, I've been trying to add parts to make it work, but have not been successful.

Any help would be appreciated.

Thank you.

worker_processes  1;
error_log  logs/error.log debug;

events {
        worker_connections  1024;
}
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 /usr/local/nginx/conf/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 {
                        include /usr/local/nginx/conf/mime.types;
                        default_type application/xml;
                        rtmp_stat all;
                        rtmp_stat_stylesheet stat.xsl;
                }
                location /stat.xsl {
                        include /usr/local/nginx/conf/mime.types;
                        default_type application/xml;
                        root /usr/local/nginx/html/stat.xsl/;
                }
        }
}
winshining commented 6 years ago

Why http://IP:8080/stat/stat.xsl? Only http://IP:8080/stat should work.

location /stat {
    rtmp_stat all;
    rtmp_stat_stylesheet stat.xsl;
}

location /stat.xsl {
    root /path/to/stat.xsl;
}