Wie leite ich Nginx basierend auf einem Unterpfad um?

Wie leite ich Nginx basierend auf einem Unterpfad um?

Ich habe Grafana und Jenkins auf derselben Azure-VM laufen. Für Jenkins: http://localhost:8080 Für Grafana: http://localhost:3000

Ich dachte, ich könnte nginx folgendermaßen einrichten. customdomain.com/grafana sollte zu http://localhost:3000 gehen, customdomain.com/jenkins oder customdomain.com sollte zu http://localhost:8080 gehen.

Aber sogar /grafana geht nur an Jenkins.

Wie kann man das beheben?

Die Standardkonfigurationsdatei für die Zuordnung in 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;
        }

verwandte Informationen