O
O
OKNOZA2015-02-26 19:49:20
Nginx
OKNOZA, 2015-02-26 19:49:20

How to properly configure Nginx to return a file?

The situation is this, you need to give the video stream "LiveStream", but here the problem is terrible.
Installed, configured, launched, works, but not as it should be.
I enter the URL 127.0.0.1 into the browser and gave a link to the stream 127.0.0.1 (set the IP to the player) everything works.
If I enter the IP of the Internet network or my local one (home) into the browser, and there 127.0.0.1 it does not work.
In general, it only works when both the browser and the player match the IP or URL, then everything works.
Here is the nginx config.

#user nobody;
worker_processes 6;

events {
    worker_connections 1024;
}
    rtmp_auto_push on;

http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
            listen 80;
            #server_name localhost;
             
              access_log /var/log/nginx/access.log;
              error_log /var/log/nginx/error.log;

            location / {
                 root /var/www;
                 index index.html index.htm;

            }


            # rtmp control
            location /control {
                 rtmp_control all;
            }

            location /hls {
                       types {
                          application/vnd.apple.mpegurl m3u8;
                          video/mp2t ts;
                       }
            root /tmp;
            }

            error_page 500 502 503 504 /50x.html;
            location =/50x.html
                       {
                         root html;
            }
      }
}

Here is the log when different URL or IP when watching TV.
95.26.4.182 - - [26/Feb/2015:19:46:51 +0300] "GET /hls/live.m3u8?time=1424969211946 HTTP/1.1" 200 227 "http://_site_.info/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36"

I suspect that the player cannot find the full path to the file and the TS slice.
I think that in this location /hls , since the video comes from a subdomain, a 3rd level domain, and I try to watch the video from the main page.
How to solve the problem ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question