Nginx Stream 模块:如何查看 TCP 选项
在 Nginx 的 Stream 模块中,可以使用 $tcp_options 变量来查看 TCP 选项。它可以在 access_log 指令中使用,并且在日志记录中包含 TCP 选项的十六进制表示。例如:
stream {
server {
listen 1234;
proxy_pass backend;
access_log /var/log/nginx/tcp.log tcplog;
}
}
http {
log_format tcplog '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$connection $tcp_options';
server {
listen 80;
location / {
proxy_pass http://backend;
}
}
}
在上面的示例中,$tcp_options 被添加到 access_log 指令中,并且在 tcp.log 日志中记录了 TCP 选项的十六进制表示。
原文地址: https://www.cveoy.top/t/topic/nF1f 著作权归作者所有。请勿转载和采集!