美文网首页
2019-05-30 nginx的stream四层方向代理

2019-05-30 nginx的stream四层方向代理

作者: 张大志的博客 | 来源:发表于2019-05-30 14:03 被阅读0次
    stream {   #注意stream要和http语句块平齐,不能在http语句块内
       server {
           listen 8080;
            return '8080 vars:
    bytes_received:$bytes_received
    bytes_sent:$bytes_sent
    remote_addr:$remote_addr
    remote_port:$remote_port
    session_time:$session_time
    status:$status
    protocol:$protocol
    ';
        }
    }
    [root@hk conf.d]#telnet 127.0.0.1 8080  #当连接后会返回变量的值
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is '^]'.
    8080 vars:
    bytes_received:0
    bytes_sent:0
    remote_addr:127.0.0.1
    remote_port:48782
    session_time:0.000
    status:000
    protocol:TCP
    Connection closed by foreign host.
    
    

    相关文章

      网友评论

          本文标题:2019-05-30 nginx的stream四层方向代理

          本文链接:https://www.haomeiwen.com/subject/fvamtctx.html