【发布时间】:2013-01-11 17:40:50
【问题描述】:
需要对基本的 Ubuntu LAMP 安装进行哪些配置以防止其记录访问者 IP 地址?
【问题讨论】:
标签: apache ubuntu lamp privacy
需要对基本的 Ubuntu LAMP 安装进行哪些配置以防止其记录访问者 IP 地址?
【问题讨论】:
标签: apache ubuntu lamp privacy
在您的 apache 配置中查找 CustomLog 指令:
fgrep -wir CustomLog /etc/apache2/
你会发现这样的东西:
CustomLog /var/log/apache2/access.log combined
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
寻找第三部分,combined 和vhost_combined 是LogFormats 的昵称。它们在/etc/apache2/apache2.conf 中定义,带有LogFormat 指令,包含几个Format Strings。
寻找
%a Remote IP-address
%h Remote host
并将它们从您的 LogFormat 指令中删除。将它们替换为 0.0.0.0 可能更明智,因此日志文件处理仍然可以进行。
之前:
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
之后:
LogFormat "0.0.0.0 %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
【讨论】:
http://httpd.apache.org/docs/2.2/mod/mod_log_config.html
Syntax: LogFormat format|nickname [nickname]
Default: LogFormat "%h %l %u %t \"%r\" %>s %b"
不要使用 %h 或 %a
【讨论】: