nginxinc / docker-nginx

Official NGINX Dockerfiles
BSD 2-Clause "Simplified" License
3.26k stars 1.73k forks source link

unknown directive "auth_request" in /etc/nginx/conf.d/edgex-default.conf:59 #891

Open divyashree123456 opened 6 months ago

divyashree123456 commented 6 months ago

while running nginx with docker i m facing error nginx: [emerg] unknown directive "auth_request" in /etc/nginx/conf.d/edgex-default.conf:59 while Running edgex napa version using docker please help me to debug the issue.

oxpa commented 6 months ago

@divyashree123456 please provide dockerfile/compose config you are using.

divyashree123456 commented 6 months ago

Hi @oxpa please find a attached docker file and compose config Dockerfile.txt using in riscv machine.

compose config for nginx:

nginx:
    command:
    - /docker-entrypoint.sh
    - nginx
    - -g
    - daemon off;
    container_name: edgex-nginx
    depends_on:
      security-secretstore-setup:
        condition: service_started
    entrypoint:
    - /bin/sh
    - /edgex-init/nginx_wait_install.sh
    environment:
      PROXY_SETUP_HOST: edgex-security-proxy-setup
      STAGEGATE_BOOTSTRAPPER_HOST: edgex-security-bootstrapper
      STAGEGATE_BOOTSTRAPPER_STARTPORT: "54321"
      STAGEGATE_DATABASE_HOST: edgex-redis
      STAGEGATE_DATABASE_PORT: "6379"
      STAGEGATE_DATABASE_READYPORT: "6379"
      STAGEGATE_PROXYSETUP_READYPORT: "54325"
      STAGEGATE_READY_TORUNPORT: "54329"
      STAGEGATE_REGISTRY_HOST: edgex-core-consul
      STAGEGATE_REGISTRY_PORT: "8500"
      STAGEGATE_REGISTRY_READYPORT: "54324"
      STAGEGATE_SECRETSTORESETUP_HOST: edgex-security-secretstore-setup
      STAGEGATE_SECRETSTORESETUP_TOKENS_READYPORT: "54322"
      STAGEGATE_WAITFOR_TIMEOUT: 60s
    hostname: edgex-nginx
    image: nginx:1.25.3-alpine-slim
    networks:
      edgex-network: {}
    ports:
    #- mode: ingress
     - 127.0.0.1:8443:8443/tcp
    read_only: true
    restart: always
    security_opt:
    - no-new-privileges:true
    tmpfs:
    - /etc/nginx/conf.d
    - /var/cache/nginx
    - /var/log/nginx
    - /var/run
    volumes:
    - edgex-init:/edgex-init:ro,z
    - nginx-templates:/etc/nginx/templates
    - nginx-tls:/etc/ssl/nginx

########################################
oxpa commented 6 months ago

Can you run 'nginx -V' in the container that fails to start and post the output here, please? We build nginx with auth_request module so my main guess is that you are trying to use some other nginx build. Or maybe the 'auth_request' line has some non-ascii characters in it and you have to retype it to make sure symbols match what nginx expects.

divyashree123456 commented 5 months ago

Hi @oxpa , I tried running nginx -V in compose file the following was a output:

Screenshot from 2024-05-23 11-08-35

the compose file is :

nginx:
    command:
    - /docker-entrypoint.sh
    - nginx
    - -V
    container_name: edgex-nginx
    depends_on:
      security-secretstore-setup:
        condition: service_started
    entrypoint:
    - /bin/sh
    - /edgex-init/nginx_wait_install.sh
    environment:
      PROXY_SETUP_HOST: edgex-security-proxy-setup
      STAGEGATE_BOOTSTRAPPER_HOST: edgex-security-bootstrapper
      STAGEGATE_BOOTSTRAPPER_STARTPORT: "54321"
      STAGEGATE_DATABASE_HOST: edgex-redis
      STAGEGATE_DATABASE_PORT: "6379"
      STAGEGATE_DATABASE_READYPORT: "6379"
      STAGEGATE_PROXYSETUP_READYPORT: "54325"
      STAGEGATE_READY_TORUNPORT: "54329"
      STAGEGATE_REGISTRY_HOST: edgex-core-consul
      STAGEGATE_REGISTRY_PORT: "8500"
      STAGEGATE_REGISTRY_READYPORT: "54324"
      STAGEGATE_SECRETSTORESETUP_HOST: edgex-security-secretstore-setup
      STAGEGATE_SECRETSTORESETUP_TOKENS_READYPORT: "54322"
      STAGEGATE_WAITFOR_TIMEOUT: 60s
    hostname: edgex-nginx
    image: nginx:1.25.3-alpine-slim
    networks:
      edgex-network: {}
    ports:
    #- mode: ingress
     - 127.0.0.1:8443:8443/tcp
    read_only: true
    restart: always
    security_opt:
    - no-new-privileges:true
    tmpfs:
    - /etc/nginx/conf.d
    - /var/cache/nginx
    - /var/log/nginx
    - /var/run
    volumes:
    - edgex-init:/edgex-init:ro,z
    - nginx-templates:/etc/nginx/templates
    - nginx-tls:/etc/ssl/nginx

And how can we configure auth _request in the nginx. please do suggest me on this Thanks in advance

divyashree123456 commented 4 months ago

please @oxpa Help me to resolve this issue.

oxpa commented 4 months ago

@divyashree123456 judging by the configure arguments - you didn't build auth request module. So you have to rebuilt nginx binary. And it also probably means that the docker image you are using is not from this repo.

divyashree123456 commented 4 months ago

Hi @oxpa , I m building nginx for riscv using this repo files as reference. Thank you for the inputs , i will try to rebuild a nginx binary.

thresheek commented 3 months ago

Hi @divyashree123456, did the rebuild fix the issue?

divyashree123456 commented 2 months ago

Hi @oxpa , we rebuild nginc with auth request module ,this issue got resloved by this . But now I m facing issue related to some file as nginx: [emerg] mkdir() "/run/nginx/client_body_temp" failed (2: No such file or directory) need to add any configurations for this. Screenshot from 2024-08-20 12-46-48 Please give your inputs for this. Thanks in advance

divyashree123456 commented 2 months ago

Hi @oxpa please give me any suggestion or a input for this issue .

oxpa commented 2 months ago

@divyashree123456 the error message contains all the information. There is nothing I can add to it.

divyashree123456 commented 2 months ago

Hi @oxpa any suggestions to resolve this. I tried creating this directory and checked but still facing issue nginx: [emerg] mkdir() "/run/nginx/client_body_temp" failed (2: No such file or directory)

oxpa commented 2 months ago

@divyashree123456 I don't think this question belongs here: this is definitely not an nginx docker image problem. And I'd like to keep issues for the repository they belong to, not to any nginx and docker issues in general. But you can still get proper help with your endeavor in community slack: https://www.f5.com/company/blog/nginx/nginx-wants-you-join-us-on-the-nginxcommunity-slack