http://pengwei.me/nginx-rtmp-secure-your-nginx-server/ Online have a solution to this problem, but I have been tested on centos and Windows, on_publish parameter is the effect, if you don't through validation of PHP page, is able to prevent the client push flow, but, as the paper said, obs pushed through to the address of the client, such as: RTMP://X.X.X.X/live/test? User=x& Pass=x, address parameter, PHP is the validation page to accept less than, so still not achieve the effect,
Could have achieved greatly, please inform the specific method? Online etc.!
CodePudding user response:
Someone made similar nginx - RTMP push flow access control?
CodePudding user response:
Online are tried, not to his study for a day, several times tests, found that the problem is acquiring parameters, you should not use _GET, the correct way is to use _POST:
The code is as follows: In setting on_publish nginx module configuration file Nginx. Conf RTMP { Server { Listen, 1935; Ping 30 s; Notify_method get;
Description: http://localhost:8080/on_publish.php; On_publish. PHP should be placed where you can execute PHP, port does not necessarily is 8080, is that you can run the PHP url and port
We then on_publish. PHP processing, for example: On_publish. PHP
<? PHP
//? User=user& Pass=pass
@ $name=$_POST [' name ']; @ $pass=$_POST [' pass '];
$savename=test; $savepass=password;
If (empty ($name) | | the empty ($pass)) {
Echo "string stream is not correct!" ; The header (' HTTP/1.0 404 Not Found ').
} else { If (STRCMP ($name, $savename)==0 & amp; & STRCMP ($pass, $savepass)==0) { Echo "string stream right!" ; } else { Echo "string stream is not correct!" ; The header (' HTTP/1.0 404 Not Found '). } }
?>
This code is a simple user authentication, authentication and add more parameters can also be changed to take database for validation, Push the end of the service flow setting With the Open Broadcaster Software (OBS), for example
1, FMS URL: RTMP://localhost: 1935/myapp
2, play the path/string stream (if present) : test? Pass=password
Which test for streamkey string stream, the name of the? Pass=password used for authentication (need to change the test to want in practical use, in the name of the password change password they want, for example, is set to 1234567890)
The client RTMP Settings:
RTMP://IP address: 1935/myapp/test
At 19:00 himself in the 2016-10-23 test success!
CodePudding user response:
Nginx - RTMP push flow access control, as long as the push control flow and control the key line of the name of the Different flow corresponding to different keys
$name is nginx - RTMP - the built-in parameters in the module name, do not change