(111: 연결 거부됨) docker를 사용하여 업스트림 nginx에 연결하는 동안

(111: 연결 거부됨) docker를 사용하여 업스트림 nginx에 연결하는 동안

nginx를 사용하여 각도 범용 앱을 도킹하려고 하는데 정말 힘든 시간을 보내고 있습니다. 나는 모든 곳을 보았지만 해결책을 찾지 못했습니다.

도커파일

FROM node:14-alpine AS builder
WORKDIR /app
COPY . .
RUN npm i && npm run build:ssr
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/dist/front-end-kevi .
ENTRYPOINT ["nginx", "-g", "daemon off;"]

내 server.ts 파일에서 포트 4000에서 앱을 시작합니다. 따라서 이 명령을 사용하여 Docker 이미지를 시작합니다.

docker run -d -p 4000:80 kevin

참고로 여기에 내 nginx conf 파일이 있습니다.

server {
listen       80;
server_name  localhost;

root   /usr/share/nginx/html;
index  index.html index.htm;

location ~* \.(eot|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}

location / {
    proxy_pass http://localhost:4000;
    try_files $uri $uri/ =404;
}

location /OrderMationApi/api/v3/ {
    proxy_pass http://102.133.225.222;
}

오류 로그에 이 오류가 표시됩니다.

7#7: 업스트림에 연결하는 동안 *1 connect()가 실패했습니다(111: 연결이 거부됨), 클라이언트: 172.17.0.1, 서버: localhost, 요청: "GET / HTTP/1.1", 업스트림: "http://127.0. 0.1:4000/", 호스트: "localhost:4000"

localhost:4000을 127.0.0.1:4000으로 변경했지만 여전히 쓸모가 없습니다.

관련 정보