0

Sorry for repeating the topic but I can't solve the problem. I don't understand what I'm doing wrong. Always shows me error:

nginx_1 | 2021/07/27 14:26:38 [emerg] 1#1: host not found in upstream "web:8000" in /etc/nginx/conf.d/nginx.conf:2 nginx_1 | nginx: [emerg] host not found in upstream "web:8000" in /etc/nginx/conf.d/nginx.conf:2

docker-compose.prod.yml

version: '3.7'

services:
  nginx:
    build: ./nginx
    ports:
      - "1337:80"
    restart: always
    depends_on:
      - web
  web:
    build:
      context: .
      dockerfile: Dockerfile.prod
    command: gunicorn znajdki.wsgi:application --bind 0.0.0.0:8000
    expose:
      - "8000"
    env_file:
      - ./.env.prod
    depends_on:
      - db
  db:
    image: postgres
    volumes:
      - postgres:/var/lib/postgresql/data
    env_file:
      - ./.env.prod.db
volumes:
  postgres:

nginx/Dockerfile

FROM nginx:stable-alpine

RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

nginx/nginx.conf

upstream znajdki {
    server web:8000;
}

server {

    listen 80;

    location / {
        proxy_pass http://znajdki;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

}
Aleooo
  • 11
  • 7

0 Answers0