Nginx static file serve

hello,

I’ve following code in my nginx configuration file for /static/ because of which if any of the service wants to access their static files then if their static file is under /static folder then this code throws 404 but if their static files are under any other folder then they are able to access. Now I want to modify this below code in such a way that any static file request should only be served if it is under /static/ folder all other requests should be 404. Please help

location ~ /static/(.*) { root /usr/share/nginx/html; access_log /var/log/nginx/static.log loginlog; rewrite ^/static(.*)$ $1 break; access_log /var/log/nginx/static.log fulllog; try_files $uri $uri/= 404; }