nginx access_log off 不起作用

nginx access_log off 不起作用

我有一个这样的 nginx 站点配置。我希望所有位置都记录到 access_log 中,除了配置中提到的位置。但是这个配置确实记录了所有/事件/lpurl 进入访问日志。我遗漏了什么吗?

server {
    listen 443 ssl http2;
    access_log /var/log/nginx/sub.example.com.log all;
    server_name sub.example.com;

    ssl on;
    ssl_certificate         /etc/nginx/ssl/example.crt;
    ssl_certificate_key     /etc/nginx/ssl/example.key;

    proxy_set_header   Host               $host;
    proxy_set_header   X-Real-IP          $remote_addr;
    proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto  $scheme;

    client_max_body_size       20m;
    client_body_buffer_size    128k;

    proxy_connect_timeout      900;
    proxy_send_timeout         900;
    proxy_read_timeout         900;

    proxy_buffer_size          32k;
    proxy_buffers              4 32k;

    location ~ ^/event/ws {
        access_log off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_buffering    off;
        proxy_redirect     off;

        proxy_pass         http://pushstream_subscriber_support;
        break;
    }

    location ~ ^/event/lp {
        proxy_buffering    off;
        proxy_redirect     off;
        access_log         off;

        proxy_pass         http://pushstream_subscriber_support;
        post_action @update_visit_expire;
        break;
    }

    location ~ ^/event/ {
        access_log off;
        proxy_buffering    off;
        proxy_redirect     off;

        proxy_pass         http://pushstream_subscriber_support;
        break;
    }
}

相关内容