'how to config rtmp://example.com when using SRS livestream

I use Nginx as proxy & SRS as Livestream server, here is my Nginx config for server block:

  `server {
    listen       80;
    listen       443 ssl http2;
    server_name  example.com;
    ssl_certificate      /usr/local/srs/conf/server.crt;
    ssl_certificate_key  /usr/local/srs/conf/server.key;

    # For SRS homepage, console and players
    #   http://r.ossrs.net/console/
    #   http://r.ossrs.net/players/
    location / {
       proxy_pass http://127.0.0.1:8080/;
    }
    # For SRS streaming, for example:
    #   http://r.ossrs.net/live/livestream.flv
    #   http://r.ossrs.net/live/livestream.m3u8
    location ~ /.+/.*\.(flv|m3u8|ts|aac|mp3)$ {
       proxy_pass http://127.0.0.1:8080$request_uri;
    }
    # For SRS backend API for console.
    location /api/ {
       proxy_pass http://127.0.0.1:1985/api/;
    }
    # For SRS WebRTC publish/play API.
    location /rtc/ {
       proxy_pass http://127.0.0.1:1985/rtc/;
    }
}`

For the config it work fine for VLC player to play the livestream from URL look like https://example.com/live/livestream.m3u8

But from my OBS software to publish the stream, I need use Ip instead the domain to work properly, look like: rtmp://my_public_ip/live

if I replace by the url look like rtmp://example.com/live => OBS doesn't work!

How can I publish stream from OBS via my domain?

I tried to use the vhost config but its didn't work.



Solution 1:[1]

Please publish to SRS directly not NGINX, and use the config for OBS:

  • Server: rtmp://srs_server_ip/live
  • StreamKey: livestream

Note that never put the livestream in Server config, it should be in the StreamKey, which is confusing.

Please read more from here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Winlin