Block domain and protect link in youtube tool

Following method to block other websites embed in your embed page

In config nginx I configure the default for you at /etc/nginx/nginx.conf, edit the block / public as follows

location /public {
	root /root/youtube;
	valid_referers blocked server_names
        domain1 domain2 your-sub-stream-domain;
	if ($invalid_referer) {
		return 403;
	}		
}

In above, domain1, domain2 is the domain that you allow to stream,
your-sub-stream-domain is the domain of the url that is used for embed. For example if I give 2 streamed domains vanlongstream.com and streamservice.online and domain of embed url is youtube.vanlongstream.com, then configure the segment The above will be

location /public  {
          root /root/youtube;
          valid_referers blocked server_names
          vanlongstream.com streamservice.online p2p.vanlongstream.com;
          if ($invalid_referer) {
            return 403;
          }
}

If you want to allow all sub domains to be streamed, the configuration will be

location /public {
          root /root/youtube;
          valid_referers blocked server_names
          vanlongstream.com *.vanlongstream.com streamservice.online *.streamservice.online youtube.vanlongstream.com;
          if ($invalid_referer) {
            return 403;
          }
}

After editing as above, you need to save nginx config file and reload nginx following the following command

nginx -t
nginx -s reload

Done!