title: Nginx call API to production server
body: <p>I am working on Angular 1 based web application.
  I've deployed a web app with nginx , but couldn't deploy production server in my local env. 
  So, I want call API from the production server. For example, 
  I am using RestAngular to call API.</p>
  
  <pre><code>Restangular.all('api/user/profile').post(mUser)
  </code></pre>
  
  <p>This calls </p>
  
  <blockquote>
    <p>localhost:8080/api/user/profile</p>
  </blockquote>
  
  <p>because I've deployed a web app in localhost:8080.</p>
  
  <p>I want to redirect requests which starts with "/API" to the production server, by config nginx properly.
  So, in this case, it should call API server</p>
  
  <blockquote>
    <p><a href="http://devprod2api/api/user/profile" rel="nofollow noreferrer">http://devprod2api/api/user/profile</a></p>
  </blockquote>
  
  <p>Other requests that don't start with "API" should go to:</p>
  
  <blockquote>
    <p><a href="http://localhost:8080/" rel="nofollow noreferrer">http://localhost:8080/</a>...</p>
  </blockquote>
  
  <p>Is it something possible by config nginx properly? If possible, how can I do that?</p>