Score:0

nginx deploying multiple sevices (ports) on one docker

in flag

I'm struggling for three days now for my nginx config, therefore maybe someone can help...

My situation now:

nginx reverse proxy <--> one VM with one DOCKER which hosts multiple services on different ports (9000 to 9005).

If i test the docker build locally with 127.0.0.1 url instead of public domain everything works fine. If i try to run with https or even https on nginx i fail.

Failings means, i can connect to my docker service 9001 (which is login service), i login into app and than there is a respone again over http and this request does not go through nginx.

My service configuration on VM/Docker

Service 9001 does have the prefix /auth Service 9002 does have the prefix /dashboard

A request looks like: http://sub.domain/auth or http://sub.domain/dashboard

on Nginx i'm searching for this prefix and therefore make a route to the correct service like so:

server {
        listen 0.0.0.0:80;
        server_name sub.domain;

        location /auth/ {
                proxy_pass http://172.18.1.25:9001;

                proxy_read_timeout 300s;

                # proxy header
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Content-Type-Options nosniff;
                proxy_set_header X-Frame-Options SAMEORIGIN;
        }

        location /dashboard/ {
                proxy_pass http://172.18.1.25:9002;

                proxy_read_timeout 300s;

                # proxy header
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Content-Type-Options nosniff;
                proxy_set_header X-Frame-Options SAMEORIGIN;
        }

        location /device/ {
                proxy_pass http://172.18.1.25:9005;

                proxy_read_timeout 300s;

                # proxy header
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Content-Type-Options nosniff;
                proxy_set_header X-Frame-Options SAMEORIGIN;
        }
}

** update ** Testet without nginx (direct open ports to vm ports) same problem.

--> next Test without docker. Running Services directly on my vm...pending

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.