nginx:哪个端口收到请求?
出于测试目的,当我发送分布式 http 请求时,我使用 nginx 来侦听多个端口。我可以看到 nginx 收到了请求 - 但我需要知道它的哪个端口实际上收到了它。我在日志中看不到任何标记此问题的选项。
我想一个丑陋的替代方案是安装多个实例,以便将它们的日志分开,但一定有比这更好的方法......?
For testing purposes, I am using nginx to listen on multiple ports when I send distributed http requests. I can see the request be received by nginx - but I need to know which of its ports actually got it. I can't see any options in the logs to flag this.
I guess an ugly alternative is to install multiple instances so their logs are separated, but there must be a better way than this...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 nginx 配置中作为变量访问的任何内容,都可以记录,包括非标准 http 标头等。
您要添加的 var 是 $server_port
Anything you can access as a variable in nginx config, you can log, including non-standard http headers, etc.
The var you want to add is $server_port