zoukankan      html  css  js  c++  java
  • nginx stream模块

    node2:/etc/nginx#/usr/local/nginx/sbin/nginx -V
    nginx version: nginx/1.17.9
    built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) 
    built with OpenSSL 1.0.1e-fips 11 Feb 2013
    TLS SNI support enabled
    configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream
    
    nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发、代理或者负载均衡等。这完全就是抢HAproxy份额的节奏,鉴于nginx在7层负载均衡和web service上的成功,和nginx良好的框架,stream模块前景一片光明。
    
    stream 模块编译
    
    stream模块默认没有编译到nginx, 编译nginx时候 ./configure –with-stream 即可
    
    
    stream core 一些变量
    
    注意:变量支持是从 nginx 1.11.2版本开始的
    
    
    
    $binary_remote_addr
    二进制格式的客户端地址
    $bytes_received
    从客户端接收到的字节数
    $bytes_sent
    发往客户端的字节数
    $hostname
    连接域名
    $msec
    毫秒精度的当前时间
    $nginx_version
    nginx 版本
    $pid
    worker进程号
    $protocol
    通信协议(UDP or TCP)
    $remote_addr
    客户端ip
    $remote_port
    客户端端口
    $server_addr
    接受连接的服务器ip,计算此变量需要一次系统调用。所以避免系统调用,在listen指令里必须指定具体的服务器地址并且使用参数bind。
    $server_port
    接受连接的服务器端口
    $session_time
    毫秒精度的会话时间(版本1.11.4开始)
    $status
    会话状态(版本1.11.4开始), 可以是一下几个值:
    200
    成功
    400
    不能正常解析客户端数据
    403
    禁止访问
    500
    服务器内部错误
    502
    网关错误,比如上游服务器无法连接
    503
    服务不可用,比如由于限制连接等措施导致
    $time_iso8601
    ISO 8601时间格式
    $time_local
    普通日志格式的时间戳
    
  • 相关阅读:
    iOS企业账号打包发布App到自己服务器上
    DBus 接口
    Ubuntu下安装gazebo
    Ubuntu下添加开机启动脚本
    Ubuntu录屏软件Kazam
    使用ceres编译报错 error: ‘integer_sequence’ is not a member of ‘std‘
    LINUX中查看、添加、删除PATH以及永久添加PATH
    Ubuntu完美解决Github网站打不开问题
    PointNet原理详解
    目标检测算法RCNN,Fast RCNN,Faster RCNN
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348335.html
Copyright © 2011-2022 走看看