1

I have read many posts on the subject but none refers to exactly the same environment I have (macOS Monterey). So what I have done so far...

I have successfully installed the latest versions of Docker & LaraDock with Apache2. I have phpMyAdmin working fine at localhost:8081. Then I followed the docs and some tutorial to set up LaraDock for multiproject.

I successfuly created a laravel9 project (ProjectA) inside the workspace container. I can view the website in the browser at localhost/ProjectA/public.

I want to create a virtual host for ProjectA to be able to type projectA.test in the browser and point to localhost/ProjectA/public.

So again, I followed the instructions on LaraDock and edited the laradock/apache2/sites/default.apache.conf:

<VirtualHost *:80>
  ServerName laradock.test
  DocumentRoot /var/www/
  Options Indexes FollowSymLinks

  <Directory "/Users/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>

and created a laradock/sites/projectA.conf:

<VirtualHost *:80>
  ServerName projectA.test
  DocumentRoot /var/www/projectA/public
  Options Indexes FollowSymLinks

  <Directory "/var/www/projectA/public">
    AllowOverride All
    <IfVersion < 2.4>
      Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
  </Directory>

</VirtualHost>

Even after restarting Apache2 in Docker, projectA.test does not display the correct website but point to the root.

In the folder apache2 there is a file called vhost.conf with Include /etc/apache2/sites-available/*.conf. When I copied the 2 conf files above into that folder (which was not there before), I get a Forbidden error : You don't have permission to access this resource. Apache/2.4.29 (Ubuntu) Server at utopia.test Port 80.

After reading an article on Apache error 403, I change the permission on the public folder to be:

sudo chmod -R 775 public
sudo chown -R _www:_www public

drwxrwxr-x@ 15 _www  _www      480 Mar 19 18:11 public

I would really appreciate if someone could help please.

1 Answer 1

1

I was so tired with this issue that I forgot to restart Apache after changing permission... that was the trick!

I hope this will help others as I did not find this solution in any of the tutorials or posts on the subject!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .