lando / drupal

The Official Drupal Lando plugin
https://docs.lando.dev/drupal
GNU General Public License v3.0
15 stars 16 forks source link

Wrong nginx user at running #124

Open jffranck opened 1 month ago

jffranck commented 1 month ago

Hi, It seems that when using nginx in via config, the user of nginx server is "daemon" instead of "www-data". As a consequency, when using the correct permissions on Drupal folders, all css and js files are returning a 403 error from nginx. The only way to fix it that I found is to add this in services config:

  appserver_nginx:
    build_as_root:
      - sed -i "s/daemon/www-data/" /opt/bitnami/scripts/nginx-env.sh

Even adding a custom server.conf with config/config/server didn't work.

reynoldsalec commented 1 month ago

@jffranck can you paste your entire Landofile? Curious if you're specifying an nginx version or making any other changes.

jffranck commented 3 weeks ago

Hi @reynoldsalec, Of course, here is my landofile:

name: project
recipe: drupal10
config:
  php: '8.3'
  via: nginx:1.24
  webroot: web
  database: mysql:8.0
  drush: true
  xdebug: true
  config:
    vhosts: docker/app/nginx/default.conf
    php: docker/app/php/php.ini
proxy:
  appserver_nginx:
    - local.project.com
    - project.lndo.site
services:
  solr:
    type: solr:8
    core: project
    forwardedport: true
    config:
      dir: docker/solr/config
  phpmyadmin:
    type: phpmyadmin
  nodejs:
    type: node:20
  appserver:
    build_as_root:
      - apt-get update -y
      - export DEBIAN_FRONTEND=noninteractive
      - apt-get install cron -yq
      - ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime
      - echo "Europe/Paris" > /etc/timezone
      - echo "$CRON_FREQUENCY root drush cron -y" >> /etc/cron.d/project
      - mkdir -p /scripts
      - ln -s /app/docker/app/scripts/cron.sh /scripts/900-cron
  appserver_nginx:
    build_as_root:
      - sed -i "s/daemon/www-data/" /opt/bitnami/scripts/nginx-env.sh
tooling:
  npm:
    description: Run npm command in the project_b5 theme
    service: nodejs
    dir: /app/web/themes/custom/project_b5
  dfp:
    description: Run the drupal_fix_permissions script
    service: appserver
    cmd: /app/vendor/metadrop/drupal-fix-permissions/drupal_fix_permissions.sh -u=www-data -g=www-data -p=/app/web
    user: root