在NAT防火墙后面是否可以在Apache日志文件中获取远程IP地址?

时间:2022-06-23 21:59:37

I'm using Apache2, Ubuntu 8.10. Currently Apache is logging the gateway's IP as the host ip, what do I have to do to get it to log the remote client's IP address instead? Is this even possible, or does the NAT router "lose" it for good?

我正在使用Apache2,Ubuntu 8.10。目前Apache正在将网关的IP记录为主机IP,我需要做些什么才能让它记录远程客户端的IP地址呢?这甚至是可能的,还是NAT路由器“丢失”了它?

Update: It actually looks like it's only logging the gateway's IP for addresses from within the network, external requests seem to be logged with the correct IP... Go figure.

更新:它实际上看起来它只记录网络内的地址的网关IP,外部请求似乎用正确的IP记录...去图。

1 个解决方案

#1


It is not apache that is fault but your NAT/Firewall. It needs to be configured to "impersonate" (not the right term, but it'll do) the IP when it sends the request to apache. How to configure that depends on the answer to the question: what is your firewall?

它不是apache故障,而是你的NAT /防火墙。它需要配置为在向Apache发送请求时“模拟”(不是正确的术语,但它会做)IP。如何配置取决于问题的答案:什么是防火墙?

#1


It is not apache that is fault but your NAT/Firewall. It needs to be configured to "impersonate" (not the right term, but it'll do) the IP when it sends the request to apache. How to configure that depends on the answer to the question: what is your firewall?

它不是apache故障,而是你的NAT /防火墙。它需要配置为在向Apache发送请求时“模拟”(不是正确的术语,但它会做)IP。如何配置取决于问题的答案:什么是防火墙?