title: Nginx forward from domain A port 8080 to domain B port 80
body: <p>Currently I'm able to do required redirrects from server A to server B, both listening port 80 default / location. </p>
  
  <p>What I need is additional forward of all requests sent to server A port 8080 non-default location /loc1 to Server B port 80 (the same) location /loc1</p>
  
  <pre><code>server {
      listen 80;
      server_name 1.1.1.1;
      return 301 $scheme://1.1.1.2$request_uri;
  }
  </code></pre>
  
  <p>Is this only doable by adding additional server section like below?</p>
  
  <p>Edit: </p>
  
  <pre><code>server {
      listen 8080;
      server_name 1.1.1.1;
  
      location /loc1 {
          return 301 $scheme://1.1.1.2:80$request_uri;
      }
  }
  </code></pre>
  
  <p>Any help is appreciated.</p>
  
  <p>Edit: Having two above "server" sections in config worked flawlessly.</p>