Laravel 5.4 on Heroku. Forbidden You don't have permission to access / on this server

I don't know why the server thinks your root is at /app but this error occurs because of the permission of the public/ directory from which Heroku is supposed to serve your application.

To resolve this issue, simply add the following to the script section of your composer.json

 "post-install-cmd": [
     "php artisan clear-compiled",
     "chmod -R 777 public/"
 ]

Note the change in permission of the public/ directory.

EDIT:

While you are at it, check your Procfile make sure it is spelled correctly and starts with an uppercase P.

PS: I know some people are really nitpicky and would say the permission is too lax. Yes, I agree with you. You can change it to something else like 775 let's just get the juice flowing.


Inside the Laravel Root folder, make a file called Procfile.

Write the following line inside the Procfile.

web: vendor/bin/heroku-php-nginx public/

Then deploy it again! Src and more here https://appdividend.com/2018/04/17/how-to-deploy-laravel-project-on-heroku/

Hope this was helpful =)


/app is the absolute path on the file system, where you app resides. The error indicates that your Procfile does not actually contain what you claim it does. You probably haven't added and committed it to Git. Apache is trying to serve from the "root" right now, not from the public/ subdirectory.