'Viewing ProjectX.test in browse returns error Forbidden You don't have permission to access this resource

I have installed LaraDock on Docker and it is running apache2. I have copied the folder of an existing Laravel 8 project (Project1) in the root of apache webserver (/User/username/Sites).

So the file structure is:

Sites
  laradock
  project1 (note that project2 folder does not exist yet)

The files look like this:

lines added into etc/hosts

127.0.0.1 Project1.test
127.0.0.1 Project2.test
...

laradock/apache2/sites/default.apache.conf

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /Users/paul/Sites
  Options Indexes FollowSymLinks

  <Directory "/Users/paul/Sites">
    AllowOverride All
    <IfVersion < 2.4>
      Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
  </Directory>

  ErrorLog /var/log/apache2/error.log
  CustomLog /var/log/apache2/access.log combined
</VirtualHost>

laradock/apache2/sites/project1.conf

<VirtualHost *:80>
  ServerName meerkatsafaris.test
  DocumentRoot /Users/paul/Sites/Project1/public
  Options Indexes FollowSymLinks

  <Directory "/Users/paul/Sites/Project1/public">
    AllowOverride All
    <IfVersion < 2.4>
      Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
  </Directory>

</VirtualHost>

In browser,

localhost displays the content of the index.php file which is there Good!
localhost/Project1/public displays the site of Project1 Good!

project1.test returns an error : Forbidden - You don't have permission to access this resource.
project2.test returns the same content as localhost

Obviously, I want project1.test to displays the project1 site. What am I doing wrong? What is the solution?



Sources

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

Source: Stack Overflow

Solution Source