: This article mainly introduces the nginx Reverse proxy TCP to fetch the RTMP stream. if you are interested in the PHP Tutorial, refer to it. Nginx Reverse proxy TCP, get RTMP stream
I. description
Nginx only supports HTTP reverse proxy by default. to support TCP reverse proxy, you must add the tcp proxy module nginx_tcp_proxy_module.
II. raw materials
1. nginx_tcp_proxy_module
:
Wget https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip
2. nginx source code
Http://nginx.org/download/nginx-1.6.3.tar.gz
Step 3
1. decompress nginx
Omitted
2. decompress nginx_tcp_proxy_module
Unzip to/nginx-1.6.3/src/nginx_tcp_proxy_module
3. patch
cd /usr/wkdir/nginx-1.6.3patch -p1 < src/nginx_tcp_proxy_module/tcp.patch
4. Compile and install
./configure --add-module=src/nginx_tcp_proxy_module-master
If the error message shows that the library is missing, install the corresponding library, such as openssl.
Solution for ubuntu: apt-get install opensslapt-get install libssl-devcentos solution: yum-y install openssl-devel
Continue compilation and installation
makemake install
5. modify the configuration file
Add in nginx. conf. the module command is TCP, which does not belong to the HTTP framework, so it is at the same level as HTTP {}.
Tcp {upstream proxy_name {# simple round-route server localhost: 1935; # port requiring proxy # check interval = 3000 rise = 2 fall = 5 timeout = 1000; # check interval = 3000 rise = 2 fall = 5 timeout = 1000 # check interval = 3000 rise = 2 fall = 5 timeout = 1000 # check_http_send "GET/HTTP/1.0 \ r \ n \ r \ n "; # check_http_expect_alive http_2xxhttp_3xx;} server {listen 8888; # proxy port 8888 proxy_pass proxy_name ;}}
6. test
Start nginx
./usr/local/nginx/sbin/nginx
Start srs
./usr/local/srs/objs/srs -c conf/srs.conf
Use ffmpeg to push rtmp to srs server (Port 1935), and then use vlc or other methods to get rtmp stream from proxy port 8888.
Self-test successful!
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above introduces the nginx Reverse proxy TCP, taking the RTMP stream, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.