无法从mod_remoteip获取mod_status中的客户端IP

时间:2012-10-24 18:50:04

标签: apache nginx reverse-proxy

我将Nginx设置为反向代理,并将IP传递给Apache。 由于某种原因,mod_status不会识别客户端IP,而是将我的网站IP显示为客户端IP。

这是我的旧Apache 2.2 mod_rpaf配置:

RPAFenable On
RPAFproxy_ips 127.0.0.1 website IP server IP
RPAFsethostname On 
RPAFheader X-Forwarded-For

新的Apache 2.4 mod_remoteip配置:

RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 website IP server IP

它是关于错误的mod_realip配置还是Apache 2.4不应该像这样工作?

此外,日志无法正常工作,但通过将格式从%h更改为%a来修复。

2 个答案:

答案 0 :(得分:1)

其他信息: Nginx代理配置     地点 / {     proxy_pass http://www.domain.com:8080;     包括/usr/local/etc/nginx/proxy.conf;     }

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

答案 1 :(得分:0)

整个早上都有类似的东西摔跤。 mod_rpaf中存在一个已知错误:https://bugs.launchpad.net/ubuntu/+source/libapache2-mod-rpaf/+bug/930540

这对我有用。在/etc/apache2/mods-available/rpaf.conf中只需替换:

<IfModule mod_rpaf.c>

使用:

<IfModule mod_rpaf-2.0.c>

(信用:https://serverfault.com/questions/393207/mod-rpaf-problems-with-nginx-front-apache-back-end-after-ubuntu-upgrade