0

如何启用 apache_note("GEOIP_ADDR"); 获取我客户的真实 IP 地址?

我们的网站通过代理服务器运行,直到上周,我们都能够通过

$ip2=apache_note("GEOIP_ADDR");
echo $ip2;

对于那些不知道的人,这将是一个很好的替代方案,$headers["X-Forwarded-For"]但是我们最近无法做到这一点。

这是加载的 Apache 模块的列表

Loaded Modules:
 core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 file_cache_module (static)
 cache_module (static)
 disk_cache_module (static)
 mem_cache_module (static)
 include_module (static)
 filter_module (static)
 deflate_module (static)
 log_config_module (static)
 logio_module (static)
 env_module (static)
 expires_module (static)
 headers_module (static)
 setenvif_module (static)
 version_module (static)
 proxy_module (static)
 proxy_connect_module (static)
 proxy_ftp_module (static)
 proxy_http_module (static)
 proxy_scgi_module (static)
 proxy_ajp_module (static)
 proxy_balancer_module (static)
 ssl_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 info_module (static)
 suexec_module (static)
 cgi_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 rewrite_module (static)
 so_module (static)
 bwlimited_module (shared)
 geoip_module (shared)
 php5_module (shared)
 pagespeed_module (shared)
Syntax OK
4

1 回答 1

1

我失踪了

    GeoIPScanProxyHeaders On

<IfModule mod_geoip.c>
        GeoIPEnable On
        GeoIPScanProxyHeaders On
        GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache
        GeoIPDBFile /usr/share/GeoIP/GeoLiteCity.dat MemoryCache
</IfModule>

这导致真实IP没有出现。

现在这可以正常工作。

于 2013-09-17T19:40:06.870 回答