需要对基本的 Ubuntu LAMP 安装进行哪些配置以防止它记录访问者的 IP 地址?
最佳答案
在 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
的昵称s。它们在 /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
关于apache - 设置不记录/存储 IP 地址的 LAMP 服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14283701/