Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

337
Vistas
infinite loop when setting up reverse proxy with docker and nginx

I'm setting up the reverse proxy with Docker and Nginx.

I used the page https://example.org/ for an example.

  1. I set up the custom domain with local mapping in /etc/hosts 127.0.0.1 example.org

  2. I set up the docker-compose file as below

version: '3'
services:
  nginx:
    image: nginx:latest
    container_name: nginx-reverse-proxy
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./nginx-selfsigned.crt:/etc/nginx/nginx-selfsigned.crt
      - ./nginx-selfsigned.key:/etc/nginx/nginx-selfsigned.key
    ports:
      - 80:80
      - 443:443
  1. Then I set up the nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;
    server {
       listen 80 default_server;
       listen 443 ssl;
       ssl_certificate nginx-selfsigned.crt;
       ssl_certificate_key nginx-selfsigned.key;
       server_name example.org;
       add_header Last-Modified $date_gmt;
       proxy_cache_bypass 1;

       location / {
           add_header  X-Upstream  'default docker' always;
           proxy_pass https://example.org;
           proxy_ssl_server_name on;
       }
    }

    include servers/*;
}

But after I run docker compose up

Then I access the page https://example.org

I got 502 bad gateway error with a lot of headers X-Upstream: default docker added which I configured

I don't know which one is wrong in the configuration :( enter image description here

UPDATED:

I'm not finding out the issue yet.

I decided to go with proxy_pass https://ip_address rather than with the domain name. I don't understand why it work with nginx on local machine but not with nginx in docker

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda