Nginx access_log off - apply to a single URL without stopping it returning a response

I'm trying to switch off access_log for a single url in a laravel application.

The url is /ignore/this/url

I need it to simply - for this one URL - NOT log information in the access_log, but I do want it to be parsed and run as it would be normally.

The normal one is:

server {
    listen 80;
    server_name localhost 127.0.0.1;
    access_log /vagrant/logs/access.log;
    error_log /vagrant/logs/error.log;

    client_max_body_size 32M;

    location / {
        root /vagrant/web;
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$args;

        location ~ \.php {
                fastcgi_pass unix:///var/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_read_timeout 60;
        }
    }
}

I've tried:

    location /ignore/this/url {
        root /vagrant/web;
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$args;

        access_log off;

        location ~ \.php {
                fastcgi_pass unix:///var/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_read_timeout 60;
        }

    }

But this seems to be ignored.

I've tried adding it inside the main location block.

location / {
        root /vagrant/web;
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$args;

    location /ignore/this/url {
            access_log off;
        }

        location ~ \.php {
                fastcgi_pass unix:///var/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_read_timeout 60;
        }

    }

But then it will give me a 404 error "File not found".


http {
   map $uri $do_log {
      /ignore/this/url 0;
      default 1;
   }

   server {
      ...
      access_log /var/log/nginx/nginx-access.log combined if=$do_log;
      
   }
}