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 调整根目录大小

要将整个 1073.7 GB 磁盘空间分配给 `/dev/mapper/centos-root`(根目录),需结合 LVM 的物理卷(PV)、卷组(VG)和逻辑卷(LV)操作。以下是详细步骤:---### **关键问题分析**1. **当前根目录大小**:328.6 GB(...… Continue reading

chrome 默认新标签页打开

Published on May 26, 2022

MTR 工具使用说明与结果分析

Published on April 29, 2022