this is a bit weird, it is not the first time (and sure not the last) I am working with apache2 in a docker cotainer. I've a look to the config apache2.conf and it looks fine to me:
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
I also add an "000-default.conf" file to the sites-available: /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/webroot
<Directory /var/www/html/webroot>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
I also tried to add the webroot folder path to this apache2.conf, but it still not working:
<Directory /var/www/html/webroot>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
My project files (index.php also) are located in /var/www/html/webroot path, but the brower shows a 403 error :"You don't have permission to access this resource."
I also checked the apache logs, and I found this.... It is very weird because I never setup this folder "/var/www/html" as the DocumentRoot (not in apache2.conf nor in 000-default.conf). But if I run an info.php script in /var/www/html I got thie env DOCUMENT_ROOT = /var/www/html.
Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
[![enter image description here][1]][1]
.httacess file: (located in /var/www/html)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
I checked that the server works, I can see the phpinfo() here http://loacalhost/info.php [1]: https://i.stack.imgur.com/QJJYC.png