# Nginx Angular reverse proxy multiple apps

**URL:** <https://forums.docker.com/t/nginx-angular-reverse-proxy-multiple-apps/122300>\
**Category:** Docker Hub\
**Tags:** docker\
**Created:** [March 16, 2022, 10:50am UTC](https://forums.docker.com/t/nginx-angular-reverse-proxy-multiple-apps/122300 "2022-03-16T10:50:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rado1207](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rado1207/32/32472_2.png) [@rado1207](https://forums.docker.com/u/rado1207)\
**Post date:** [March 16, 2022, 10:50am UTC](https://forums.docker.com/t/nginx-angular-reverse-proxy-multiple-apps/122300/1 "2022-03-16T10:50:52Z")

</div>

I try to run multiple angular apps on same port with nginx and docker. I started with one and set the followings:

**nginx/default.conf**

```auto
upstream client {
    server client:4200;
}
server {
    listen 80;
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://client/;
    }
}

```

**docker-compose.yml**

```auto
version: "3.8"
services:
    client:
        build:
            context: ./client
        ports:
            - "4200:4200"
        container_name: client

    nginx:
        restart: always
        image: nginx:latest
        container_name: nginx
        volumes:
            - "./nginx/default.conf:/etc/nginx/conf.d/default.conf"
        ports:
            - "8080:80"

```

**client/Dockerfile**

```auto
# Stage 1
FROM node:14.19.0-alpine as node
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
RUN npm install -g @angular/cli
COPY . .
RUN npm run build --prod

# Stage 2

EXPOSE 4200
CMD ng serve --prod --host 0.0.0.0

```

All containers up after i run:

```auto
docker-compose up --build -d

```

And i can access the app in directory “client” via [http://localhost:8080/](http://localhost:8080/)

Now, i want to change in nginx/default.conf

```auto
location /

```

to

```auto
location /client1

```

I get white page and in docker logs:

```auto
2022/03/15 14:20:42 [error] 33#33: *3 open() "/etc/nginx/html/styles.css" failed (2: No such file or directory), client: 172.21.0.1, server: , request: "GET /styles.css HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/client1"
172.21.0.1 - - [15/Mar/2022:14:20:42 +0000] "GET /styles.css HTTP/1.1" 404 555 "http://localhost:8080/client1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36" "-"
2022/03/15 14:20:42 [error] 33#33: *3 open() "/etc/nginx/html/polyfills.js" failed (2: No such file or directory), client: 172.21.0.1, server: , request: "GET /polyfills.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/client1"
172.21.0.1 - - [15/Mar/2022:14:20:42 +0000] "GET /polyfills.js HTTP/1.1" 404 555 "http://localhost:8080/client1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36" "-"
2022/03/15 14:20:42 [error] 34#34: *6 open() "/etc/nginx/html/runtime.js" failed (2: No such file or directory), client: 172.21.0.1, server: , request: "GET /runtime.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/client1"
172.21.0.1 - - [15/Mar/2022:14:20:42 +0000] "GET /runtime.js HTTP/1.1" 404 555 "http://localhost:8080/client1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36" "-"
2022/03/15 14:20:42 [error] 31#31: *7 open() "/etc/nginx/html/main.js" failed (2: No such file or directory), client: 172.21.0.1, server: , request: "GET /main.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/client1"
172.21.0.1 - - [15/Mar/2022:14:20:42 +0000] "GET /main.js HTTP/1.1" 404 555 "http://localhost:8080/client1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36" "-"

```

Please help.
