设置不记录/存储IP地址的LAMP服务器?

时间:2013-01-11 17:40:51

标签: apache ubuntu lamp privacy

需要对基本的Ubuntu LAMP安装进行哪种配置以防止它记录访问者的IP地址?

2 个答案:

答案 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

查找第三部分,combinedvhost_combinedLogFormat的昵称。它们在/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