2

I have a new Laravel 5 project on my Mac. Everything from github is set up and should work. It actually works on http://localhost:8000/ after running this command:

php artisan serv

But, i am seeing a 403 error when I type myprojectname.local in the browser when i want to use virtualhost.

I have several noframework projects in Php and they are still working fine, I can run them through my browser (Chrome) using otherproject.local Therefore I don't think VirtualHosts si the reason.

I am thinking about an authorization problem, so I checked the Owner and the group of my folder (/Users/username/Documents/foldername) but they are similar to the configuration in /private/etc/apache2/httpd.conf see bellow

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User username
Group staff

but there are so many "httpd.conf" in XAMPP and in private/etc etc... that I feel a bit lost.

On my errorlog (that i already set up in debug mode) here is what i see:

[Fri Aug 12 16:15:34.606324 2016] [authz_core:debug] [pid 40647] mod_authz_core.c(809): [client ::1:52290] AH01626: authorization result of Require all denied: denied
[Fri Aug 12 16:15:34.606428 2016] [authz_core:debug] [pid 40647] mod_authz_core.c(809): [client ::1:52290] AH01626: authorization result of <RequireAny>: denied
[Fri Aug 12 16:15:34.606436 2016] [authz_core:error] [pid 40647] [client ::1:52290] AH01630: client denied by server configuration: /Users/username/Documents/foldername/public/
[Fri Aug 12 16:15:34.606527 2016] [authz_core:debug] [pid 40647] mod_authz_core.c(809): [client ::1:52290] AH01626: authorization result of Require all granted: granted
[Fri Aug 12 16:15:34.606533 2016] [authz_core:debug] [pid 40647] mod_authz_core.c(809): [client ::1:52290] AH01626: authorization result of <RequireAny>: granted
[Fri Aug 12 16:15:34.606591 2016] [charset_lite:debug] [pid 40647] mod_charset_lite.c(219): [client ::1:52290] AH01448: incomplete configuration: src unspecified, dst unspecified
[Fri Aug 12 16:15:34.607115 2016] [authz_core:debug] [pid 40647] mod_authz_core.c(809): [client ::1:52290] AH01626: authorization result of Require all granted: granted
[Fri Aug 12 16:15:34.607130 2016] [authz_core:debug] [pid 40647] mod_authz_core.c(809): [client ::1:52290] AH01626: authorization result of <RequireAny>: granted
[Fri Aug 12 16:15:34.607139 2016] [charset_lite:debug] [pid 40647] mod_charset_lite.c(219): [client ::1:52290] AH01448: incomplete configuration: src unspecified, dst unspecified
guillim
  • 1,517
  • 1
  • 12
  • 16

1 Answers1

0

Finally found out:

  1. The file that I needed to modify was located here:

/Applications/XAMPP/xamppfiles/etc/httpd.conf

  1. What I needed to add inside this file was:

     <Directory "/Users/username/Documents/foldername">
         Options +Indexes +FollowSymLinks +MultiViews
         AllowOverride All
         Require all granted 
     </Directory>
    


Explanation:

The reason why I needed to insert the bloc above is: at the begining of httpd.conf, this part sets every folder as follows:

<Directory />
    AllowOverride none
    Require all denied
</Directory>     

Which very probably causes Laravel to be denied from accessing the project folder

Now the error-log looks good:

[Tue Aug 16 14:47:12.326388 2016] [authz_core:debug] [pid 13960] mod_authz_core.c(809): [client ::1:52515] AH01626: authorization result of <RequireAny>: granted

Looking at it now, the difficult part was to fin the proper httpd.conf, among the numerous files named the same. I hope it will help

guillim
  • 1,517
  • 1
  • 12
  • 16