Не проходит проксирование

Всем привет, я новичок в связи с чем у меня возникла ошибка, которую я не могу решить. nginx: [emerg] invalid port in upstream "app:" in /etc/nginx/conf.d/default.conf:9

Мой Dockerfile

FROM python:3.10
COPY . .
WORKDIR .
RUN python3 -m pip install -r requirements.txt
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0"]

Мой docker-compose

version: "3.7"
services:

  # nginx service
  web:
    container_name: "web"
    image: nginx
    depends_on:
      - app
    ports:
      - "8082:80"
    volumes:
      - ./nginx/conf.d/nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - custom

  # application service
  app:
    container_name: "app"
    image: app
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8000:8000"
    networks:
      - custom

networks:
  custom:
    driver: bridge

nginx.conf

upstream app {
    server app:8000;
}

server {
    listen 80;

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

Логи

Attaching to app, web 
web  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration 
web  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ 
web  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh web  | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf 
web  | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version 
web  | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh 
web  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh 
web  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh 
web  | /docker-entrypoint.sh: Configuration complete; ready for start up 
web  | 2023/11/30 09:28:42 [emerg] 1#1: invalid port in upstream "app:" in /etc/nginx/conf.d/default.conf:9 
web  | nginx: [emerg] invalid port in upstream "app:" in /etc/nginx/conf.d/default.conf:9 web exited with code 1 app  
| INFO:     Started server process [1] app  
| INFO:     Waiting for application startup. app  
| INFO:     Application startup complete. app  
| INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

Если перейти по ссылке, то введите сюда описание изображения

После комментария evo я удалил двоеточие в nginx.conf Теперь у меня следующие логи

app  | INFO:     Started server process [1]
app  | INFO:     Waiting for application startup.
app  | INFO:     Application startup complete.
app  | INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
web  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
web  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
web  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
web  | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
web  | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
web  | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
web  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
web  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
web  | /docker-entrypoint.sh: Configuration complete; ready for start up
web  | 2023/11/30 10:40:23 [notice] 1#1: using the "epoll" event method
web  | 2023/11/30 10:40:23 [notice] 1#1: nginx/1.25.3
web  | 2023/11/30 10:40:23 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
web  | 2023/11/30 10:40:23 [notice] 1#1: OS: Linux 5.10.60.1-microsoft-standard-WSL2
web  | 2023/11/30 10:40:23 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker processes
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 28
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 29
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 30
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 31
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 32
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 33
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 34
web  | 2023/11/30 10:40:23 [notice] 1#1: start worker process 35

Но приложение в браузере всё ровно не запускается в браузере(

Если я некорректно задал вопрос, пожалуйста, сообщите об этом)


Ответы (1 шт):

Автор решения: Arthur Langley-Reddle
server {
    listen 80;
    server localhost; # or your FQDN 
    location / {
        proxy_pass http://app:8000;
    }
→ Ссылка