一个服务器块的Nginx error_log过滤器

时间:2019-04-21 10:41:15

标签: nginx

我想从Nginx的错误日志中删除“禁止”的403错误消息。每次有人访问文件夹而不是文件时,都会将其添加到日志中:

2019/04/21 09:57:50 [error] 30368#30368: *1132461 directory index of "/var/www/domain.com/html/assets/js/" is forbidden

/etc/nginx/sites-available/domain.com

server {
    ...

    map $status $only_200 {
        ~^200 0;
        default 1;
    }
    error_log /var/www/domain.com/html/api/logs/nginx-error.vc combined if=$only_200;
}

我已经尝试了很多这样的组合,但是即使复制/粘贴,我的语法也似乎是错误的。我想念什么?

0 个答案:

没有答案