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

I created my project folder in Ubuntu at: /home/my_username/Projects/drupal9doc1
And put in this folder Docker-based Drupal stack: docker4drupal
Configured the docker-compose.yml and .env files and then wrote the command in the terminal: docker-compose up -d
running the necessary images for the local rise of the Drupal site.

I created index.php files with phpinfo() function in my project folder to test how everything works.
I wrote in the url http://drupal9doc1.localhost:8000
And File not found is displayed on my page page instead of the php version.

Part of the code in the docker-compose.yml file

Part of the code in the .env file

Do you have any suggestions as to why the index.php file for a nginx / docker is not visible?
If you need more information, write me in the comments.

Good morning,

some things come to my mind when reading your config-screenshots:

1 - Please check in traefik’s dashboard if your nginx-container is listed there as routers and services - otherwise traefik does not know where to forward the requests to. There is only one label for the NginX-container related to traefik. I would use at least four labels (copy & paste from one of my configs - web is the name of my router/service for this container - and of course the value for the rule will be different for you):

labels:
- “traefik.enable=true”
- “traefik.http.services.web.loadbalancer.server.port=80”
- “traefik.http.routers.web.rule=PathPrefix(`/`)”
- “traefik.http.routers.web.entryPoints=http”

2 - You can also check with docker-compose logs -f nginx if requests are processed by the nginx-container. If not the requests are not forwarded by traefik - so check why (and you are back at the previous point :slight_smile: )

3 - Does the nginx-container know that it should forward requests for php-files to the php-container?

4 - You are mounting your project-folder to nginx-container’s /var/www/html/but not to the php-container. So even if Nginx might get the request and knows that it should forward a request for *.php to the php-container, the php-container does not have access to the php-file…

5 - I would not mount my project-folder a container - instead I would create a subfolder for the data (or use a data-volume) and mount this subfolder to the container. Usually the container does not need access to all of my project-files like docker-compose.yml and so on.

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