There is a file on the server

/opt/data/data.json 

It is necessary that when accessing via the path /?format=json or in any given predetermined way, give this local file.

I understand that you can put it in a static-directory and apply, this option is not suitable.

Can you please tell me the solution

Ps. Yes, there was a solution for /json

 location /json { index /opt/data/data.json; } 

But how to set the path with the parameters /?format=json

    1 answer 1

    For URLs with /json-path/?format=json parameters, the config is

     location /json-path/ { index data.$arg_format; alias /opt/data/; }