Establish connectivity between Nginx and a web application in ECS

0

Howdy,

I am trying to host a basic web application on ECS. I have a cluster set up for my web front end (nginx) and another cluster for my backend application (ctfd). I am attempting to have nginx act as a reverse proxy and forward HTTP traffic to my ctfd container which is listening on port 8000. Both applications are configured to use the same namespace which I've called "ctfd-api-dns". Both containers are hosted on fargate with the network mode set to avsvpc.

When I run my nginx task, it fails with the error:

nginx: [emerg] host not found in upstream "ctfd:8000" in /etc/nginx/nginx.conf:13

This error seems to indicate nginx is unable to resolve the address or reach the ctfd container running under the ctfd task.

Here is the nginx configuration being used by the nginx task running in the nginx cluster.

https://pastebin.com/raw/xzgkH2Nq

How can I establish connectivity between these two containers so that nginx acts as a reverse proxy for ctfd?

Cheers

1개 답변
1
수락된 답변

Hello,

The connection between the Nginx container and the app should be using localhost:port instead of "container name" and port.

The blog post NGINX reverse proxy sidecar for a web container hosted with Amazon ECS and AWS Fargate explains this with more details.

Hope this helps!

profile pictureAWS
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠