【问题标题】:Setting up a LAMP server that doesn't log/store IP addresses?设置不记录/存储 IP 地址的 LAMP 服务器?
【发布时间】:2013-01-11 17:40:50
【问题描述】:

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

【问题讨论】:

    标签: apache ubuntu lamp privacy


    【解决方案1】:

    在您的 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_combinedLogFormats 的昵称。它们在/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
    

    【讨论】:

      【解决方案2】:

      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

      【讨论】:

        猜你喜欢
        • 2013-05-08
        • 2013-06-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-11-29
        • 2016-09-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多