How to remove .php extension (Nginx)


I know LBF is for WordPress sites but a few of my client sites only require WordPress for blog pages, so I have WordPress in a subdirectory, they call it headless WordPress right?

Is there a way to gracefully remove the .php extension using the etc/nginx/site.conf ?

I want to change, to

I tried adding location blocks that I found on stack overflow but it didn’t work.