0

I am learning nginx, trying to setup an in-house server. My configuration is:

upstream app{
    server app:8000;
}

server {

    listen 80;

    location /api/app/ {
        proxy_pass http://app;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }
}

I want to request nginx with localhost/api/app/admin, but my app can only respond to app:8000/admin. Hence, I want only admin/ to be passed to the application. I tried using rewrite, but was not able to get the desired result.

Ayush Pallav
  • 919
  • 9
  • 18
  • See [this answer](https://stackoverflow.com/questions/59309405/nginx-on-ec2-instance-does-not-serve-static-files/59312241#59312241). – Richard Smith May 19 '20 at 15:05
  • That did not work. That answer is probably not relevant to this issue. Doing that is equivalent to requesting my nginx with localhost/admin – Ayush Pallav May 19 '20 at 15:22
  • I want to request my nginx with localhost/api/app/admin, but my app can only response to app:8000/admin – Ayush Pallav May 19 '20 at 15:22

0 Answers0