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

221
Vistas
Nginx fails to start with no logs

I'm trying to run Nginx in docker, but the Nginx keeps failing.

Nginx config file:

worker_processes 1;
error_log  /var/log/nginx/my_error.log;
pid        /var/log/nginx/nginx.pid;

events {
  worker_connections 1024; # increase if you have lots of clients
  accept_mutex off; # set to 'on' if nginx worker_processes > 1
}

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

  upstream app_server {
    server localhost:5000 fail_timeout=0;
  }

  server {
    client_max_body_size 4G;

    location @proxy_to_app {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;
      # we don't want nginx trying to do something clever with
      # redirects, we set the Host: header above already.
      proxy_redirect off;
      proxy_pass http://localhost:5000;
    }

    listen 443 ssl; 
    ssl_certificate /etc/ssl/certificate.pem;
    ssl_certificate_key /etc/ssl/key.pem;
    }
}

Dockerfile:

RUN apt-get update && apt-get install -y nginx
COPY ssl/certificate.pem /etc/ssl/certificate.pem
COPY ssl/key.pem /etc/ssl/key.pem
COPY nginx_configuration/nginx.conf /etc/nginx/nginx.conf
EXPOSE 443
EXPOSE 5000
RUN /etc/init.d/nginx start
CMD ["python3",  "my_app"]

But when I check the nginx status:

/etc/init.d/nginx status
[FAIL] nginx is not running ... failed!

When I run:

/etc/init.d/nginx start

Everything works as expected.

I checked the log files, there are all empty.

Thanks, Omer

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This line is only being executed during image creation. So when a container is created "it does nothing"

RUN /etc/init.d/nginx start

What you are really running inside your container is this python script. I think there is no reference to it in your question.

CMD ["python3",  "my_app"]

You can use the following Dockerfile

FROM nginx
COPY ssl/certificate.pem /etc/ssl/certificate.pem
COPY ssl/key.pem /etc/ssl/key.pem
COPY nginx_configuration/nginx.conf /etc/nginx/nginx.conf
EXPOSE 443
EXPOSE 5000
over 4 years ago · Santiago Trujillo Denunciar
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