Пример проксирования отдельного приложения с переписыванием пути

http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 10000m;
      
    error_log   logs/error.log debug;
  
    sendfile        on;   
    keepalive_timeout  65;
  
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
  
    upstream httpServer {
        server localhost:9090;       
    }   
   
    upstream debugServer {
        server localhost:9091;
    }
  
    # Redirect HTTP to HTTPS
    server {
        listen          80;
        server_name     proxy server.example.com;       
        return 301      https://server.example.com$request_uri;
    }
  
          
    # HTTPS Proxy Server
    server {
        listen       443 ssl;
        server_name  server.example.com;
  
        # Ключ сертификата должен быть с путым паролем       
        ssl_certificate         c:/app/nginx/proxy.crt;        
        ssl_certificate_key     c:/app/nginx/proxy_free.key;    
        ssl_protocols           TLSv1 TLSv1.1 TLSv1.2;
  
        # Говорим браузеру, что сервер доступен только по HTTPS
        # Это предотвращает возможность перехода обратно на HTTP с атакой по назащищенному каналу
        add_header Strict-Transport-Security 'max-age=604800' always;       
          
        # HTTP                    
        location /elm-demo/app/ {          
            proxy_pass http://localhost:9090/applications/demo/;                   
  
            proxy_http_version 1.1;
  
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $server_name;
            proxy_set_header X-Forwarded-Port $server_port;
            proxy_set_header X-Forwarded-Proto $scheme;                         
            proxy_set_header X-Forwarded-Prefix /elm-demo; 
            proxy_set_header X-Forwarded-Endpoint /app;
        }       
  
        location /elm-demo/auth/ {
            proxy_pass http://localhost:9090/auth/;
  
            proxy_http_version 1.1;
  
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $server_name;
            proxy_set_header X-Forwarded-Port $server_port;
            proxy_set_header X-Forwarded-Proto $scheme;    
            proxy_set_header X-Forwarded-Prefix /elm-demo;
        }
  
        location /elm-demo/static/ {
            proxy_pass http://localhost:9090/static/;
  
            proxy_http_version 1.1;
  
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $server_name;
            proxy_set_header X-Forwarded-Port $server_port;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Prefix /elm-demo;
        }
  
        # Debug (Web Sockets)   
        location /debug {
            proxy_pass http://debugServer/;           
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;           
            proxy_http_version 1.1;            
        }      
    }
}