Setting up API endpoint and Nginx

Using advance template and created new app ‘api’ specifically for api endpoint.
I’ve been having problem setting up nginx. I’ve googled but can’t find resource to make it work.

Here’s the scenario. Main web site, eg http://www.mysite.com, points to frontend. I’d like to config http://mysite.com/rest/api point to api.

Any idea?