you can try to remove the line of
try_files $uri $uri/ =404;
and by default nextjs build directory is .next/static you can try change alias path into
.next/static
location /_next/{ alias /path/.next/; expires 365d; access_log off; }