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
posta un mese fa583 visualizzazioni
1 Risposta
1
Risposta accettata

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
con risposta un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande