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

446
Vistas
Docker Nginx directory index of "/src/" is forbidden in Kubernetes

I'm getting a directory index of "/src/" is forbidden error when setting up Docker Nginx configuration within Kubernetes. Here is the error from the Kubernetes logs.

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2021/03/11 02:23:24 [error] 23#23: *1 directory index of "/src/" is forbidden, client: 10.136.144.155, server: 0.0.0.0, request: "GET / HTTP/1.1", host: "10.42.3.4:80"
10.136.144.155 - - [11/Mar/2021:02:23:24 +0000] "GET / HTTP/1.1" 403 125 "-" "kube-probe/1.15"

My dockerfile to serve nginx for an Angular app is quite simple:

FROM nginx

RUN rm /etc/nginx/conf.d/default.conf

COPY ./nginx/conf.d /etc/nginx/

COPY dist /src

RUN ls /src

My nginx.conf file contains:

worker_processes  1;

events {
    worker_connections  1024;
}

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

    server {
        listen       80;
        server_name 0.0.0.0;
        root   /src;

        charset utf-8;
        include h5bp/basic.conf; # eg https://github.com/h5bp/server-configs-nginx
        include modules/gzip.conf;

        location =/index.html {
            include modules/cors.conf;
        }

        location / {
            try_files $uri$args $uri$args/ /index.html;
        }
    }
}

The Kubernetes deployment is using a Quay image. Do you think my error could be in the dockerfile, the nginx.conf file, or both?

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

0

In Dockerfile copy line, you are copying conf.d to nginx folder, try to change that

FROM nginx

RUN rm /etc/nginx/conf.d/default.conf

COPY ./nginx/conf.d /etc/nginx/conf.d

COPY dist /src

RUN ls /src
over 4 years ago · Santiago Trujillo Denunciar

0

I solved my error by changing my Angular build outputPath to "dist" rather than the default "dist/my-project" that was configured with the Angular installation.

"architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist", // was previously "dist/my-project"
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