0

I want to redirect all request to specific servers for example:

/f - redirect to localhost:8001

/c - redirect to localhost:8000

/c/test - redirect to localhost:8000/test

I try this code but all request to any url nginx will redirect to /c and proxy pass to localhost:8000

server {
   listen       80;
   server_name  localhost;
    
   location /f {
       proxy_pass http://localhost:8001/;
   }
   location /c {
        proxy_pass http://localhost:8000/;
   }
   location / {
       return 301 /c;
   }
}
MM4
  • 1
  • 3

0 Answers0