nginx icon indicating copy to clipboard operation
nginx copied to clipboard

How to add nginx user to www-data group in wodby/nginx image?

Open superromeo opened this issue 9 months ago • 1 comments

Hello!

I am using the wodby/nginx image to run a Drupal project. To ensure nginx has read access to the Drupal files, I need to add the nginx user to the www-data group.

Could you please advise on the recommended way to add the nginx user to the www-data group in your image? Are there any built-in mechanisms or best practices for this?

I wouldn't want to give all files read access for all users.

Thank you in advance for your help!

  php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_EXTENSIONS_DISABLE: xhprof,spx,xdebug
      PHP_MAIL_MIXED_LF_AND_CRLF: 'On'
      PHP_MEMORY_LIMIT: 1G
      PHP_MAX_EXECUTION_TIME: 600
      PHP_MAX_INPUT_VARS: 50000
      PHP_OPCACHE_MEMORY_CONSUMPTION: 512
      PHP_OPCACHE_INTERNED_STRINGS_BUFFER: 32
      PHP_OPCACHE_MAX_ACCELERATED_FILES: 100000
      PHP_OPCACHE_REVALIDATE_FREQ: 2
      PHP_OPCACHE_ENABLE_CLI: 1
      PHP_FPM_USER: wodby
      PHP_FPM_GROUP: wodby
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ../:/var/www/html:cached

  nginx:
    image: wodby/nginx:$NGINX_TAG
    container_name: "${PROJECT_NAME}_nginx"
    depends_on:
      - php
    environment:
      NGINX_STATIC_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: error
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/html/web
      NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
    volumes:
      - ../:/var/www/html:cached
    labels:
      - "traefik.http.routers.${PROJECT_NAME}_nginx.rule=Host(`${PROJECT_BASE_URL}`)"

superromeo avatar Jun 04 '25 17:06 superromeo