Make a separate location
that doesnʼt do the proxying. For example, this is what I have in my configs:
location /.well-known/acme-challenge/ {
root /run/nginx; # Replace with the path to your webroot directory
default_type text/plain;
}
HTH