title: NGINX rewrite location to another port
body: <p>Have installed NGINX so I can divert </p>
  
  <pre><code>http://example.com/Dev/ to http://example.com:8080/apex/f?p=4550:1
  </code></pre>
  
  <p>I thought I found the solution and gave it a go:</p>
  
  <p>Changed ngnix.config </p>
  
  <pre><code>   location /dev/ {
         rewrite ^/(/dev/)(.*)$ http://localhost:8080/apex/$1 break;
         rewrite_log on;
      }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>sudo systemctrl reload nginx
  </code></pre>
  
  <p>But when I try <a href="http://example.com/Dev/" rel="nofollow noreferrer">http://example.com/Dev/</a> on a browser</p>
  
  <p>I get the 500 error.</p>
  
  <p>Website is listening to 8080 and NGiNX listening to 80</p>
  
  <p>Also tried </p>
  
  <pre><code>location /dev {
      rewrite ^/dev(.*) /apex/$1 last;
      proxy_pass http://localhost:8080;
  }
  </code></pre>