Nginx config: two applications under same domain

I have two applications: HTML+JS frontend and PHP backend. I would like to set Nginx up so that both are served from the same domain. Requests to the backend are made uing URLs starting with /api. ...