N
N
nathan1117772021-08-09 15:30:47
PHP
nathan111777, 2021-08-09 15:30:47

Why can't nginx or docker see the index.php file?

I created my project folder in Ubuntu at: /home/NameUser/Projects/drupal9doc1
And put it there: Docker-based Drupal stack
I set up the files docker-compose.ymland .envthen wrote the command in the terminal: docker-compose up -d

And I have launched the necessary images for the local rise of the Drupal site
new_drupal9doc1_nginx
new_drupal9doc1_php
new_drupal9doc1_mariadb
new_drupal9doc1_pma
new_drupal9doc1_mailhog
new_drupal9doc1_crond
new_drupal9doc1_traefik

I created in the same index.php folder a file with a function phpinfo()to test how everything works.
And registered in the url http://drupal9doc1.localhost:8000
And I displayed on the page File not found instead of the php version.

Code part of docker-compose.yml file

php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      DB_HOST: $DB_HOST
#      DB_PORT: $DB_PORT
      DB_USER: $DB_USER
      DB_PASSWORD: $DB_PASSWORD
      DB_NAME: $DB_NAME
      DB_DRIVER: $DB_DRIVER
    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: debug
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/html
      NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
    #      NGINX_DRUPAL_FILE_PROXY_URL: http://example.com
    volumes:
    - ./:/var/www/html:cached
#    - mutagen:/var/www/html
    labels:
    - "traefik.http.routers.${PROJECT_NAME}_nginx.rule=Host(`${PROJECT_BASE_URL}`)"

  traefik:
    image: traefik:v2.0
    container_name: "${PROJECT_NAME}_traefik"
    command: --api.insecure=true --providers.docker
    ports:
    - '8000:80'
#    - '8080:8080' # Dashboard
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

.env file code

PROJECT_NAME=new_drupal9doc1
PROJECT_BASE_URL=drupal9doc1.localhost

DB_NAME=drupal
DB_USER=drupal
DB_PASSWORD=d
DB_ROOT_PASSWORD=p
DB_HOST=mariadb
DB_PORT=3306
DB_DRIVER=mysql

### --- MARIADB ----
MARIADB_TAG=10.5-3.13.2

### --- VANILLA DRUPAL ----
DRUPAL_TAG=9-4.33.2

### --- PHP ----
# Linux (uid 1000 gid 1000)
PHP_TAG=7.4-dev-4.27.0

### --- NGINX ----
NGINX_TAG=1.20-5.15.0
NGINX_VHOST_PRESET=drupal9


### --- SOLR ---
SOLR_CONFIG_SET="search_api_solr_4.1.6"
SOLR_TAG=8-4.11.1

### --- ELASTICSEARCH ---

ELASTICSEARCH_TAG=7-5.11.4

### --- KIBANA ---
KIBANA_TAG=7-5.11.4

### --- REDIS ---
REDIS_TAG=6-3.9.2


### --- NODE ---
NODE_TAG=14-dev-0.58.0


### --- VARNISH ---
VARNISH_TAG=6.0-4.7.2


### --- POSTGRESQL ----
POSTGRES_TAG=13-1.23.0


### OTHERS

ADMINER_TAG=4-3.15.1
APACHE_TAG=2.4-4.6.0
ATHENAPDF_TAG=2.16.0
DRUPAL_NODE_TAG=1.0-2.0.0
MEMCACHED_TAG=1-2.9.1
OPENSMTPD_TAG=6.0-1.10.0
RSYSLOG_TAG=latest
SELENIUM_CHROME_TAG=3.141
WEBGRIND_TAG=1-1.21.1
XHPROF_TAG=3.0.3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nathan111777, 2021-08-10
@nathan111777

Solution: You need to DELETE the docker-compose-override.yml file from the project folder and everything will work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question