Think before you speak, read before you think.

记录指定状态码的 nginx log

by

in

在 server 里配置,记录 403 的日志

server {
    server_name example.com;
    access_log /var/log/nginx_access_403.log combined;
    include block_inject.conf;
    location / {
        if ($status != "403") {
            access_log off;
        }
        #......
    }
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *