Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!