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

Chair
gefragt vor einem Monat583 Aufrufe
1 Antwort
1
Akzeptierte Antwort

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
beantwortet vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen