Closed struffel closed 1 year ago
Hi, ehm so If I am not completely wrong ... you understand it not correct. The document root var is used for a volume mount. This volume will be mapped from your pc to the default docroot inside the container. The Container expects the docroot under /var/www/html so therfore from the inside view of the container its totally okay when this is stays unchanged. The only thing you can control with the docroot var from the env file is the Volume you want to map into the container under /var/www/html. So the string inside the apacheconfig will never change when you change the docroot var in the env.
from docker-compose.yml
volumes:
- ${DOCUMENT_ROOT-./www}:/var/www/html:rw
Let me know if that explanation was useful to you :)
Describe the bug The environment variable APACHE_DOCUMENT_ROOT is ignored, instead the default
/var/www/html
value is used.which Branch / PHP Version are you using ? php81
Steps to reproduce Steps to reproduce the behavior: Set up the .env file with these settings:
(The entire src-folder should be mounted to the container but only the path
/src/public
should be used as the root so that other code is outside the document root.)When using this setup and performing
docker compose up
the document root for the apache server is still set to/var/www/html
. This can be verified by launching a shell inside the php81 container (docker exec) and printing the configuration file:cat /etc/apache2/sites-available/000-default.conf
The important line still readsDocumentRoot /var/www/html
and this is also the setting that the apache server actually uses.Expected behavior The config file should contain
/var/www/html/public
as the document root, as specified in the .env file and the server should use the public folder as the document root.Screenshots
Desktop (please complete the following information): Windows 10 Home with Docker Desktop 4.10.1 using Docker Engine v20.10.17.
Additional context Here is the entire .env file: