docker-nginx icon indicating copy to clipboard operation
docker-nginx copied to clipboard

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

Open divyashree123456 opened this issue 1 year ago • 13 comments

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.

divyashree123456 avatar May 17 '24 12:05 divyashree123456

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

oxpa avatar May 17 '24 12:05 oxpa

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

########################################

divyashree123456 avatar May 17 '24 13:05 divyashree123456

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.

oxpa avatar May 17 '24 13:05 oxpa

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 avatar May 23 '24 06:05 divyashree123456

please @oxpa Help me to resolve this issue.

divyashree123456 avatar Jul 15 '24 13:07 divyashree123456

@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.

oxpa avatar Jul 15 '24 13:07 oxpa

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.

divyashree123456 avatar Jul 16 '24 05:07 divyashree123456

Hi @divyashree123456, did the rebuild fix the issue?

thresheek avatar Aug 15 '24 23:08 thresheek

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 avatar Aug 20 '24 07:08 divyashree123456

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

divyashree123456 avatar Aug 26 '24 06:08 divyashree123456

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

oxpa avatar Aug 26 '24 08:08 oxpa

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)

divyashree123456 avatar Aug 26 '24 08:08 divyashree123456

@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

oxpa avatar Aug 27 '24 20:08 oxpa