小编mda*_*yan的帖子

nginx:如何禁用 ($http_status == 200) 的 access_log

有没有办法禁用access_log200 HTTP 响应代码?我尝试使用条件,但似乎块access_log中不允许使用指令if。我试过这个:

access_log /var/log/nginx/access_log;

if ($http_status == 200){
    access_log off;   # <---------
}
Run Code Online (Sandbox Code Playgroud)

但它无效

# nginx -t    
nginx: [emerg] "access_log" directive is not allowed here ...
Run Code Online (Sandbox Code Playgroud)

有什么办法可以做到这一点吗?

nginx http-status-code

4
推荐指数
1
解决办法
4890
查看次数

标签 统计

http-status-code ×1

nginx ×1