【问题标题】:Can't get client IPs in mod_status from mod_remoteip无法从 mod_remoteip 获取 mod_status 中的客户端 IP
【发布时间】:2012-10-14 21:06:39
【问题描述】:

我将 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 来修复。

【问题讨论】:

  • 您找到解决方案了吗?查看 mod_status 页面时,我也无法获得真实 IP。

标签: apache nginx reverse-proxy


【解决方案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;

【讨论】:

    【解决方案2】:

    整个早上都在与类似的事情搏斗。 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-30
      • 2014-10-06
      • 2015-09-01
      • 2012-09-02
      • 1970-01-01
      • 2011-12-03
      • 2017-03-24
      • 2020-12-08
      相关资源
      最近更新 更多