SetEnvIf阻止日志记录

时间:2018-07-12 16:00:17

标签: apache

正在尝试从我的Apache2日志中阻止这些日志。但是完全没有这样做。

    51.234.25.54 - - [12/Jul/2018:15:41:54 +0000] "GET /news/data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFB....this goes on for a while....I+7FVSMp16oS3W5cJ+lxGbJ50ppS" 414 0 "-" "-"
    ::1 - - [12/Jul/2018:15:41:56 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) (internal dummy connection)"

在apache2.conf中

    <Directory /var/www/>
        SetEnvIf Remote_Addr "::1" dontlog
        SetEnvIf User-Agent "Apache/2.4.25 (Debian) (internal dummy connection)" dontlog
        SetEnvIf Request_URI "GET*data:image*" dontlog
        SetEnvIf User-Agent "-" dontlog
        Options -Indexes -FollowSymLinks -Includes -ExecCGI
        AllowOverride None
        LimitRequestBody 51200000
        Order allow,deny
        allow from all
    </Directory>

在这样的站点中。

    <VirtualHost *:80>
        ServerName www.news.com
        DocumentRoot /var/www/news.com/public_html
        ServerAlias news.com

        SetEnvIf Remote_Addr "::1" dontlog
        SetEnvIf User-Agent "Apache/2.4.25 (Debian) (internal dummy connection)" dontlog
        SetEnvIf Request_URI "GET*data:image*" dontlog
        SetEnvIf User-Agent "-" dontlog

        ErrorLog /var/www/logs/error-nsim.log
        CustomLog /var/www/logs/requests-nsim.log combined
        ErrorDocument 403 /http_error_403_forbidden.html
        ErrorDocument 404 /http_error_404_not_found.html
        ErrorDocument 410 /http_error_410_gone.html

        <Directory "/var/www/...and so on

在这样的网站中可用

    <VirtualHost *:80>
        ServerName www.news.com
        DocumentRoot /var/www/news.com/public_html
        ServerAlias news.com

        ErrorLog /var/www/logs/error-nsim.log
        CustomLog /var/www/logs/requests-nsim.log combined
        ErrorDocument 403 /http_error_403_forbidden.html
        ErrorDocument 404 /http_error_404_not_found.html
        ErrorDocument 410 /http_error_410_gone.html

        SetEnvIf Remote_Addr "::1" dontlog
        SetEnvIf User-Agent "Apache/2.4.25 (Debian) (internal dummy connection)" dontlog
        SetEnvIf Request_URI "GET*data:image*" dontlog
        SetEnvIf User-Agent "-" dontlog

        <Directory "/var/www/...and so on

每次都重新启动Apache。每次都无法阻止它们。

0 个答案:

没有答案