如何在apacheconfiguration中testing条件?

我想在apache中testing一个configuration。 我怎样才能“debugging”configuration文件? 例如,假设我有:

<IfModule mod_geoip.c> GeoIPEnable On GeoIPDBFile PATH_TO_LIB\GeoIP.dat GeoIPEnableUTF8 On GeoIPOutput All </IfModule> 

我可以在本地发送伪造的IP到头部吗? (即)我可以在本地伪造/剥离另一个IP比127.0.0.1?

有了这种configuration,你不能(至less很容易)。 我build议进行testing,你添加这个选项:

GeoIPScanProxyHeaders On

从文档( http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Proxy-Related_Directives

当这个设置的时候,这个模块会按照这个顺序查看IP地址的其他几个来源:

HTTP_CLIENT_IP环境variables(由Apache设置)。

HTTP_X_FORWARDED_FOR环境variables(由Apache设置)。 X-Forwarded-For for标题(由代理设置)。

HTTP_REMOTE_ADDR环境variables(由Apache设置)。

设置该选项进行testing,完成后将其删除。 然后你可以发送任意的IP作为HTTP标头curl,例如:

curl --header "X-Forwarded-For: 1.2.3.4" "http://your.site/path"