Score:0

How to redirect nginx based on sub path?

kr flag

I have grafana and jenkins running on same azure vm. For jenkins: http://localhost:8080 For grafana: http://localhost:3000

I thought to set nginx in such a way. customdomain.com/grafana should go to http://localhost:3000 customdomain.com/jenkins or customdomain.com should go to http://localhost:8080

But even /grafana is going to jenkins only.

How to fix that?

The, default config file for mapping 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;
        }
us flag
Please add output of `curl -v` when you visit `/grafana` URL.
user7138814 avatar
us flag
Maybe you need `proxy_redirect off;` for the /grafana location
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.