Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

496
Visualizações
Nginx up like orphan containers and not working (521 error)

I am using a container Nginx with docker-compose, but It have a bad configuration. When I link the domain to 8000 port I have a 521 error.

enter image description here

It is my Dockerfile:

 FROM nginx
 COPY nginx.conf /etc/nginx/nginx.conf

I used nginx-alpine, but it not working without alpine python, and I had to change it because Pandas not working with alpine.

So, my nginx.conf is:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
 worker_connections  1024;  ## Default: 1024, increase if you have lots of clients
}

http {
 include       /etc/nginx/mime.types;
 # fallback in case we can't determine a type
 default_type  application/octet-stream;

 log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
 '$status $body_bytes_sent "$http_referer" '
 '"$http_user_agent" "$http_x_forwarded_for"';

 access_log  /var/log/nginx/access.log  main;

 sendfile        on;
 #tcp_nopush     on;

 keepalive_timeout  65;

 upstream app {
    server django:5000;
 }

server {
# use 'listen 80 deferred;' for Linux
# use 'listen 80 accept_filter=httpready;' for FreeBSD
listen 5000;
charset utf-8;

# Handle noisy favicon.ico messages in nginx
 location = /favicon.ico {
    return 204;
    access_log     off;
    log_not_found  off;
}

 location / {
    # checks for static file, if not found proxy to app
    try_files $uri @proxy_to_app;
}

# django app
 location @proxy_to_app {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forward-Proto http;
    proxy_set_header X-Nginx-Proxy true;
    proxy_temp_file_write_size 64k;
    proxy_connect_timeout 10080s;
    proxy_send_timeout 10080;
    proxy_read_timeout 10080;
    proxy_buffer_size 64k;
    proxy_buffers 16 32k;
    proxy_busy_buffers_size 64k;
    proxy_redirect off;
    proxy_request_buffering off;
    proxy_buffering off;
    proxy_pass http://app;
}
}
}

When I build and up my application, not show any error, and I tip "docker-compose ps" it appear, like the photo, but in some time it disappear, and if I try to do some action with some container, it response:

WARNING: Found orphan containers (core_nginx_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.

I tried to make a .env with COMPOSE_PROJECT_NAME=CORE but not working anyway.

It is my production.yml:

nginx:
  build: ./compose/production/nginx
  image: core_production_nginx
  ports:
  - 80:80
  depends_on:
  - django

I tried to add 80:5000 but it response me a error.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

When your container disappeared that means that it down. You can see all containers, upped and down, with command docker ps -a. You will find your disappeared container here

When you use command docker ps you never see any errors. This command show you only working containers. If you want to see errors inside the container, you should use command docker logs <container name>. And when your container disappeared that means that it down. You can see all containers, upped and down, with command docker ps -a. You will find your disappeared container here. You should use docker logs and you will see why this container down.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda