1、nginx 从1.9.0版本开始支持四层代理,但做四层代理时 编译需要添加  --with-stream模块

# ./configure --prefix=/usr/local/nginx--user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-file-aio --with-stream

2、nginx配置文件

user www;
worker_processes 2;
events {
worker_connections 1024;
}
stream {                                           #stram模块 和http模块是一同等级;做四层代理时需要添加上这个模块;
      server {
          listen 30028;                          #30028端口将以4层TCP协议方式转发至后端app_sever;
          proxy_pass app_server;
      }
      upstream app_server{
          server 172.22.0.44:30028;

server 172.22.0.45:30028;
      }
}
http {
      include mime.types;
      default_type application/octet-stream;
      sendfile on;
      keepalive_timeout 65;
      server {
               listen 80;
               server_name localhost;
               location / {
                    root html;
                    index index.html index.htm;
               }
               error_page 500 502 503 504 /50x.html;
               location = /50x.html {
                   root html;
               }
     }
}

nginx 4层代理配置的更多相关文章

  1. nginx实现反向代理 配置多域名以及多端口号

    多个服务部署在同一个服务器,使用不同的端口. 一.思考过程 如果不想带上端口号,就只能访问 80 或 443 端口. 可以用过二级目录区分服务,通过反向代理转发到不同的 Server. 可以用过子域名 ...

  2. Nginx之反向代理配置(二)

    前文我们聊了Nginx的防盗链.反向代理以及开启nginx代理缓存,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/12417130.html:今天我们继续说ng ...

  3. linux 安装 nginx 及反向代理配置

    Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,以下为Linux centos平台下安装nginx并配置反向代理的过程(采用源码安装的方式) 一:安装 ...

  4. nginx 安装及代理配置。

    新建etc/yum.repos.d/nginx.repo文件,添加以下内容:[nginx] name=nginx repo baseurl=http://nginx.org/packages/cent ...

  5. Nginx之反向代理配置(一)

    前文我们聊了下Nginx作为web服务器配置https.日志模块的常用配置.rewrite模块重写用户请求的url,回顾请参考https://www.cnblogs.com/qiuhom-1874/p ...

  6. Centos 7 上使用nginx为Node.js配置反向代理时错误:(13: Permission denied) while connecting to upstream

    错误来源:Centos 7 上使用nginx为Node.js配置反向代理时产生(13: Permission denied) while connecting to upstream的错误 nginx ...

  7. nginx 4层tcp代理获取真实ip

    举个例子,Nginx 中的代理配置假如是这样配置的: location / { proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_a ...

  8. niginx代理配置

    常用关键词:rewrite.proxy_pass location ^~ /address/ { proxy_set_header Host xx.sohu.com; #设置header proxy_ ...

  9. niginx相关命令及代理配置

    安装 in mac https://www.cnblogs.com/meng1314-shuai/p/8335140.html Nginx相关命令 mac下启动: 通过brew 安装install 后 ...

随机推荐

  1. other#apache-commons

    if you want to be a better javaer, you should  spent time on apache commons.

  2. Metasploit学习笔记——情报搜集技术(只记录与metasploit有关的)

    1.外围信息搜集 1.1whois域名注册信息查询 示例代码如下 msf > whois testfire.net 1.2网站的目录结构 示例代码如下 msf > use auxiliar ...

  3. leetcode1161 Maximum Level Sum of a Binary Tree

    """ BFS遍历题,一遍AC Given the root of a binary tree, the level of its root is 1, the leve ...

  4. 关于cvPyrSegmentation(src, dst, storage, &comp, level, threshold1, threshold2)函数报错的问题解答

    先挂上我写的代码: #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <highgui.h> #incl ...

  5. 【转帖】影响超 10 亿设备,博通和 Cypress 芯片曝惊天漏洞,苹果、华为、三星等中招

    影响超 10 亿设备,博通和 Cypress 芯片曝惊天漏洞,苹果.华为.三星等中招   https://www.infoq.cn/article/lpNEQGrxZL22gHDPBE2z   26 ...

  6. P1001 害死人不偿命的(3n+1)猜想 (Basic Level)

    转跳点:

  7. crmv2项目

    maven -----------------------------------------------------------------------------感谢打赏!

  8. React 组件通讯

    React   父→子组件通讯   在父组件中子组件上  绑定一个 变量名={要传递的数据}:走我们去子组件中接收....      直接用  this.props.刚刚起的变量名就ok了    上代 ...

  9. DFS(深度优先搜索遍历求合格条件总数)--07--DFS--蓝桥杯方格填数

    此题方法多种,我用规范的DFS来求解 题目:方格填数 如下的10个格子,填入0~9的数字.要求:连续的两个数字不能相邻. (左右.上下.对角都算相邻)一共有多少种可能的填数方案?   输出 请填写表示 ...

  10. 二十七、SAP中通过以字段的形式输出内容

    一.输出时,需要加入关键词sy-vline,代码如下 二.效果如下