Nginx配置TCP请求转发

Reading time ~1 minute

1. 概述

通过Nginx对tcp连接进行请求转发.

2. 编译安装 Stream 组建

./configure --prefix=/usr/local/nginx --with-stream  --with-stream_ssl_module

3. 配置Nginx的配置文件conf/nginx.conf

stream {
    upstream proxy_card {
        # simple round-robin  转发IP和端口
        server 192.168.1.12:12340;
        server 192.168.1.13:12340;
        #check interval=3000 rise=2 fall=5 timeout=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 {
        listen 12340; #监听端口
        proxy_pass proxy_card;  #转发请求
    }
}

4. 重启Nginx

./nginx -s stop
./nginx

转载请注明出处:
文章地址: Nginx配置TCP请求转发
作者: mraxu

Linux 使用nmtui修改主机名以及IP

## 步骤1.修改主机名 1. 终端里输入**nmtui** ![image](https://i.imgur.com/EhSXKYK.png) 2. 选择`Set system hostname`![image](https://vgy.me/G417qh.png) 3....… Continue reading

Linux 创建LVM卷并挂载使用

Published on July 04, 2019

Linux DHCP 学习笔记

Published on July 04, 2019