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.
网友评论