title: how to prevent Nginx to redirect location to a configured proxy_pass url and port number
body: <p>Hi guys i am having a problem with nginx, i have configure <code>phpmyadmin</code> to run with nginx <code>phpmyadmin</code> is configured to run on port <strong>8080</strong>. I access <code>phpmyadmin</code> via  localhost/phpmyadmin and it give me the proper login screen below.</p>
  
  <p><a href="https://i.stack.imgur.com/ht3UP.png" rel="nofollow noreferrer">phpmyadmin login screen</a></p>
  
  <p>after login the url on the address bar changes to the configure port from localhost/phpmyadmin to localhost:8080/phpmyadmin and it throws</p>
  
  <p><a href="https://i.stack.imgur.com/66iJF.png" rel="nofollow noreferrer">error message</a></p>
  
  <p>here is my nginx configuration:</p>
  
  <pre><code>server{
      listen 443 ssl;
      ssl_dhparam /etc/ssl/certs/dhparam.pem;
      ssl_certificate /etc/certificate/live/localhost/permission.pem;
      ssl_certificate_key /etc/certificate/live/localhost/privkey.pem;
      include /etc/certificate/live/localhost/ssl-nginx.conf;
  
      access_log /var/log/nginx/apache2-access.log;
      error_log /var/log/nginx/apache2-error.log;
  
  location /phpmyadmin{
          proxy_set_header X-Forwarded-Host $host;
          proxy_set_header X-Forwarded-Server $host;
          proxy_set_header Host $http_host;
          proxy_set_header X-Ssl on;
          proxy_set_header X-NginX-Proxy true;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://127.0.0.1:8080/phpmyadmin;
          proxy_redirect off;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks in advance.</p>