'Apache 403 Forbidden You don't have permission to access / on this server

I am new to Docker and Apache and am trying to execute a very simple program that would display a web page on my localhost. However, I keep getting a 403 Forbidden error saying that

"You don't have permission to access / on this server"

. I am using Apache/2.4.25 (Debian) Server at localhost Port 5002. The path to the directory is ~/tutorial/product. I have read many solutions on here, and have tried all of them, but none of them have worked for me.

/etc/apache2/apache2.conf

<Directory /var/www/html>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

/etc/apache2/sites-enabled/000-default.conf

ServerAdmin webmaster@localhost
DocumentRoot /var/www/signature

<Directory /var/www/signature/>
   Allowoverride all
   Order allow,deny
   Allow from all
   Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

I have included the permissions at each directory in the path using ls -l:

~/tutorial

|---------------------|------------------|
|     -rwxr-xr-x      |docker-compose.yml|
|---------------------|------------------|
|     drwxr-xr-x      |    product       |
|---------------------|------------------|
|     drwxr-xr-x      |    website       |
|---------------------|------------------|

~/tutorial/products

|---------------------|------------------|
|     -rwxr-xr-x      |     api.py       |
|---------------------|------------------|
|     -rwxr-xr-x      |    Dockerfile    |
|---------------------|------------------|
|     -rwxr-xr-x      |     index.php    |
|---------------------|------------------|
|     -rwxr-xr-x      | requirements.txt |
|---------------------|------------------|


Solution 1:[1]

You're missing files in your Docker Container. You need to issue the command below to take your file from your machine to the docker container.

Out of your container issue this command.

docker cp index.php 4fdb84ef3ef4:/var/www/html/index.php

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 unixmiah