Nginx reverse proxy TCP, fetch RTMP stream

Source: Internet
Author: User
Nginx reverse proxy TCP, fetch RTMP stream

I. Description
Nginx is only supported by default HTTP reverse proxy, if need to support TCP reverse proxy to add TCP Proxy module: Nginx_tcp_proxy_module.

Second, raw materials
1.nginx_tcp_proxy_module
Download Address:
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

Third, step
1. Unzip the Nginx
Slightly

2. Unzip the 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 & Install

./configure --add-module=src/nginx_tcp_proxy_module-master

If the error is missing a library, install the appropriate library, such as OpenSSL

ubuntu下解决办法:apt-get install opensslapt-get install libssl-dev-y install openssl openssl-devel

Continue compiling the installation

makemake install

5. Modify the configuration file
Add in nginx.conf, the module directive is TCP, it is not within the HTTP framework, so and http{} the same level

tcp {    upstream proxy_name {        # simple round-robinserver localhost:1935;#需要代理的端口#check interval=3000 rise=2 fall=5timeout=1000;#check interval=3000 rise=2 fall=5timeout=1000#check interval=3000 rise=2 fall=5timeout=1000#check_http_send "GET /HTTP/1.0\r\n\r\n";#check_http_expect_alive http_2xxhttp_3xx;    }    server {        8888#代理8888端口        proxy_pass proxy_name;    }}

6. Testing
Start Nginx

./usr/local/nginx/sbin/nginx

Start SRS

./usr/local-c conf/srs.conf

Use FFmpeg to push the rtmp stream to the SRS server (port 1935) and then get the rtmp stream through VLC or otherwise to agent Port 8888.

Self-Test success!

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the Nginx reverse proxy TCP, take the rtmp stream, including the aspects of the content, I hope that the PHP tutorial interested friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.