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

354
Views
Corregir el equilibrio de carga de nginx.conf a uvicorn FastAPI con docker-compose

Quiero usar nginx como equilibrador de carga para mis réplicas de FastAPI, pero no puedo hacer que funcione. Leí que uvicorn también puede hacerlo, pero nginx manejaría muy bien el equilibrio de carga. publicación del foro

me sale un error

 host not found in upstream "inconnect1:5001"

docker-compose.yml

 version: "3" networks: proxy-tier: external: name: nginx-proxy services: inconnect1: image: inconnect:0.1 container_name: inconnect1 environment: - PORT=5001 volumes: - ./inconnect/app:/app ports: - 5001:5001 nginx: image: jwilder/nginx-proxy container_name: nginx ports: - 80:80 - 443:443 volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./letsencrypt/certs:/etc/nginx/certs:ro - ./nginx/nginx.conf:/etc/nginx/nginx.conf networks: - proxy-tier restart: always deploy: mode: replicated replicas: 1

nginx.conf

 worker_processes 1; events { worker_connections 1024; } http { sendfile on; upstream restapis { server inconnect:5001; } server { listen 80; location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; proxy_buffering off; proxy_pass http://restapis; } location /static { # path for static files root /path/to/app/static; } } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Como su archivo nginx.conf:

server inconnect:5001; debe ser server inconnect1:5001;

Y en el archivo de redacción de la ventana acoplable, debe usar el link del contenedor nginx a la aplicación inconnect1 . (eliminar red en contenedor nginx)

 image: jwilder/nginx-proxy container_name: nginx ports: - 80:80 - 443:443 volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./letsencrypt/certs:/etc/nginx/certs:ro - ./nginx/nginx.conf:/etc/nginx/nginx.conf links: - "inconnect1:inconnect1" restart: always deploy: mode: replicated replicas: 1

O usar en 1 red:

 networks: proxy-tier: driver: bridge services: inconnect1: image: inconnect:0.1 container_name: inconnect1 environment: - PORT=5001 volumes: - ./inconnect/app:/app ports: - 5001:5001 networks: - proxy-tier nginx: image: jwilder/nginx-proxy container_name: nginx ports: - 80:80 - 443:443 volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./letsencrypt/certs:/etc/nginx/certs:ro - ./nginx/nginx.conf:/etc/nginx/nginx.conf networks: - proxy-tier restart: always deploy: mode: replicated replicas: 1
over 4 years ago · Santiago Trujillo Report
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!