如何使用nginx反向代理设置本地网站以执行api请求

如何使用nginx反向代理设置本地网站以执行api请求,nginx,web,cross-domain,reverse-proxy,Nginx,Web,Cross Domain,Reverse Proxy,现在我只有一个localhost网站:localhost:8080 我需要跨域调用api 以下是两个后端api url: www.example.com/api/site/login www.example.com/api/site/register 如何使用nginx在本地设置反向代理

现在我只有一个localhost网站:localhost:8080

我需要跨域调用api 以下是两个后端api url:

  • www.example.com/api/site/login
  • www.example.com/api/site/register
  • 如何使用nginx在本地设置反向代理