Как перенаправить nginx на основе подпути?

Как перенаправить nginx на основе подпути?

У меня grafana и jenkins запущены на одной виртуальной машине Azure. Для jenkins: http://localhost:8080 Для grafana: http://localhost:3000

Я думал настроить nginx таким образом. customdomain.com/grafana должен перейти на http://localhost:3000 customdomain.com/jenkins или customdomain.com должен перейти на http://localhost:8080

Но даже /grafana отправляется только в jenkins.

Как это исправить?

Файл конфигурации по умолчанию для сопоставления в nginx.

 location /grafana {
                include /etc/nginx/proxy_params;
                proxy_pass          http://localhost:3000;
                proxy_read_timeout  60s;
        # Fix the "It appears that your reverse proxy set up is broken" error.
        # Make sure the domain name is correct
                #proxy_redirect      http://localhost:3000 https://customdomain.com;
        }

        location / {
                include /etc/nginx/proxy_params;
                proxy_pass          http://localhost:8080;
                proxy_read_timeout  60s;
        # Fix the "It appears that your reverse proxy set up is broken" error.
        # Make sure the domain name is correct
                proxy_redirect      http://localhost:8080 https://customdomain.com;
        }

Связанный контент