////
Search
Duplicate
🎴

Nginx + Spring Boot / docker-compose 에러

생성일
2022/04/08 07:42
태그
발생한 에러 사항
도커 컴포즈로 두개의 컨테이너를 묶어서 띄운 상황에서 실행하면, Nginx에서 connection refused에러 발생
에러 내용
team-g-web-1 | 2022/04/08 07:23:26 [error] 23#23: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.22.0.1, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/hello", host: "127.0.0.1"
nginx location 블럭에서 server-proxy를 localhost로 설정해둔게 문제였음
Docker should be usually running on host ip and not loopback address (127…0.0.1) so replace “localhost” in your service url in your services config to http://:9090/…
해결 방법
nginx conf 파일내에 proxy server url을 도커 컨테이너 이름으로 다시 설정