693579551 发表于 2018-11-15 11:21:10

nginx rwrite及增加不记录特定状态日志nginx模块

server {  
    access_log_bypass_if ($status = 400);
  
    access_log_bypass_if ($host ~* 'nolog.com');
  
    access_log_bypass_if ($uri = 'status.nginx') and;
  
    access_log_bypass_if ($status = 200);
  
}
  
In the case, nginx will not write access log when the status code is 400, or when the host is 'nolog.com', or when the uri is 'status.nginx' and the status code is 200.
  
However, if you define them both in the blocks in the father child relationship, the child block will not inherit and merge the configuration in parent block, of course. FOr example:
  
server {
  
    access_log_bypass_if ($status = 400);
  
    location / {
  
      access_log_bypass_if ($host ~* 'nolog.com');
  
    }
  
}


页: [1]
查看完整版本: nginx rwrite及增加不记录特定状态日志nginx模块