需要对基本的Ubuntu LAMP安装进行哪种配置以防止它记录访问者的IP地址?
答案 0 :(得分:0)
在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
是LogFormat
的昵称。它们在/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
答案 1 :(得分:0)
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