Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Connect Nginx and Django containers [host not found in upstream]

I've created 2 containers for both, Django and Nginx. It's working perfectly on my desktop, but when I pull my images from Docker Hub in an AWS EC2 instence and run, I got this error:

/docker-entrypoint.sh: Configuration complete; ready for start up
2021/08/24 15:09:39 [emerg] 1#1: host not found in upstream "my_server:8000" in /etc/nginx/conf.d/default.conf:2
nginx: [emerg] host not found in upstream "my_server:8000" in /etc/nginx/conf.d/default.conf:2

Here is my docker-compose.yml

version: '3.7'

services:
  my_server:
    image: user/image-app
    build:
      context: .
    env_file:
      - ./.env
    ports:
      - "8000:8000"

  nginx:
    build: ./nginx
    image: user/image-nginx
    ports:
      - "80:80"
    depends_on:
      - my_server

volumes:
  static:

My default.conf file

upstream django {
    server my_server:8000;
}

server {
    listen 80;

    location / {
        proxy_pass http://django;
    }
}

Even after I try to add a network and change to "8000:80" the Django ports like this:

version: '3.7'

services:
  scrimmage:
    image: user/image-app
    build:
      context: .
    env_file:
      - ./.env
    ports:
      - "8000:80"
    networks:
      - django_network

  nginx:
    build: ./nginx
    image: user/image-nginx
    container_name: nginx
    ports:
      - "80:80"
    depends_on:
      - scrimmage
    networks:
      - django_network

volumes:
  static:

networks:
  django_network:
    driver: bridge

And change the the default.conf to this:

upstream django {
    server my_server;
}

server {
    listen 80;

    location / {
        proxy_pass http://django;
    }
}

Still not working. Also this changes don't work at my local machine. The first configuration works fine locally, like I said before.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda