nginx: [emerg] invalid port in url "https://x.x.x.x./live/rtmp/auth"?

1.3k views Asked by At

I am getting this message after changing my auth url to https. Is there a way to change callback to https or is it not supported for on_publish directive ? FYI - ngixn is ssl enabled.

1

There are 1 answers

0
Matéo On

I don't know if you have solved the problem, but I have encountered the same one. In researching, it seems that the on_* directives do not support secure connections.

So I tried to work around the problem by serving my web application locally in http like this:

  • /etc/nginx/sites-available/yourdomain.conf :
rtmp {

        server {


                listen 1935;
                chunk_size 4096;

                application live {

                        deny play all;

                        record off;

                        live on;
                        on_publish http://127.0.0.1:8080/api/stream;
                        on_done http://127.0.0.1:8080/api/stream/end;

                }

        }

}
  • /etc/nginx/nginx.conf :
server {

        listen [::]:443 ssl ipv6only=on; # managed by Certbot
        listen 443 ssl; # managed by Certbot

        root /var/www/html/myapp/public;

        index index.html index.php;

        server_name yourdomain.com www.yourdomain.com;

        # rest of your config...

}

# then, serve your app on localhost for call api locally with http from on_* directives

server {

        listen 8080;
        listen [::]:8080;

        server_name 127.0.0.1;

        root /var/www/html/myapp/public;

        index index.html index.php;

        location / {

                try_files $uri $uri/ /index.php?$query_string;

        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php8.0-fpm.sock;
        }

}

If it helps others :)