arut / nginx-rtmp-module

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

rtmp module is not connectable #1299

Open Popupkiller opened 6 years ago

Popupkiller commented 6 years ago

Over the past few day, I have been trying to get this module to work. The last thing I did yesterday, was to set up Ubuntu in vmware, with a bridged network adapter. I can access Ubuntu like any other networked device in my LAN.

I used this guide to install nginx and the RTMP module: https://www.withoutthesarcasm.com/installing-nginx-rtmp-module-ubuntu-dpkg/

The installation went without issues.

The server is starting up as a service in my clean Ubuntu install. I am able to access the default web-page on port 80, from any unit in my LAN, or from WAN. But the RTMP module does not respond when I try to connect OBS to it.

The service is running.

rtmp@RTMP:~$`` service nginx status
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since ma. 2018-07-16 12:23:19 CEST; 11min ago
  Process: 1100 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 1066 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 1103 (nginx)
   CGroup: /system.slice/nginx.service
           ├─1103 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           ├─1104 nginx: worker process                           
           ├─1105 nginx: worker process                           
           ├─1106 nginx: worker process                           
           └─1107 nginx: worker process                           

juli 16 12:23:16 RTMP systemd[1]: Starting A high performance web server and a reverse proxy server...
juli 16 12:23:19 RTMP systemd[1]: Started A high performance web server and a reverse proxyserver.

This is my config file: I know there is lots I can remove here, but for testing purposes, I leave everything as is for now.

#user  nobody;
worker_processes  1;

error_log  logs/error.log;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;

    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

I have tried stopping and starting the service. I've tried restarting Ubuntu. I have made sure the firewall in Ubuntu was not active. I have tried activating the firewall and adding port 1935 as an exception. I have made the same exception in my windows firewall, and forwarded the port in my router.

I have tried reinstalling it several times from scratch.

I first tried installing Ubuntu through the Windows Store, and then Nginx and rtmp using the same tutorial, I tried uninstaling Ubuntu, and reinstalling everything. And finally I went for the vmware option, but nothing seems to work.

OBS always tells me "Failed to connect to server." Stream URL I'm using is: rtmp://192.168.0.160/live and stream key is set to: test no authentication is active.

I am using nginx-1.10.3

the module is in there, as far as I can see.

rtmp@RTMP:~/nginx/nginx-1.10.3/debian/modules$` ls
headers-more-nginx-module  nginx-cache-purge     nginx-development-kit  nginx-http-push  nginx-rtmp-module      nginx-upstream-fair  ngx_http_substitutions_filter_module
nginx-auth-pam             nginx-dav-ext-module  nginx-echo             nginx-lua        nginx-upload-progress  ngx-fancyindex       README.Modules-versions

I am by no means a Linux expert. Its the first time I've installed Ubuntu this weekend, and I have only a few hours of gui experience from way before, so excuse me if I have missed something obvious.

Does anyone know what the heck is going on? It seems to me that everything should be working, but it's not.

I have uncommented the error logs in the config, but I am not able to find any log folders, so I'm guessing no errors have been produced, or I'm looking at the wrong place.

Any help would be hugely appreciated. I really want to get this working. I have so many ideas of how to use this.

Thank you in advance.

UKNickyD commented 6 years ago

Try adding a stream name to the connect url like so...

rtmp://192.168.0.160/live/testing

Popupkiller commented 6 years ago

The issue isn't that I can't watch the stream. The issue is that I cant send the stream to the server, as it won't connect for some reason. With my streamkey set to "test" without quotation in OBS, the URL for watching the stream would be rtmp://192.168.0.160/live/test Unless I have misunderstood something here. capture capture2

UKNickyD commented 6 years ago

Try scrapping the stream key, and add /test to the end of the url like so...

rtmp://192.168.0.160/live/test

Popupkiller commented 6 years ago

Nope. That does not work, and from all I've read about this RTMP server the last few weeks, thats not really how it works. You point the stream to the server "rtmp:///" Then you point it at the correct application on the server "/live/" and then you give it a "name" using the streamkey, which gives it a unique ID you can pull the stream from.

But for some reason I am unable to connect to the server in the first place, using RTMP.

SoftwareMagicIT commented 5 years ago

Issue is in libcurl3. If you use latest not work. I'm in same situation, because I need to upgrade libcurl3 but rtmp module stop working after upgrade.

braysonjohn148 commented 8 months ago

Did you find a solution, i am using ubuntu. I tried every means

Popupkiller commented 8 months ago

Did you find a solution, i am using ubuntu. I tried every means

Honestly. I don't remember. Sorry. It's been years since I posted this. Didn't even remember I did.

braysonjohn148 commented 8 months ago

I am using a server from aws, i have installed nginx, libnginx-mod-rtmp and setup my nginx.conf

`rtmp {

    access_log /var/log/nginx/rtmp.log;
    server {
            listen 1935;
            chunk_size 4096;

            application live {
                    live on;
                    record off;
            }
    }

}` rtmp://3.139.1.144/live stream_key: test

Still getting Failed to connect

braysonjohn148 commented 8 months ago

Finally fixed it.

My server is hosted by AWS which I forgot to allow port 1935 in the security groups.