Laravel – Forbidden You don’t have permission to access / on this server

My laravel installation was working fine yesterday but today I get the following error:

Forbidden

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

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Does anyone know where I am going wrong?

Asked on July 5, 2020 in Apache.
Add Comment
3 Answer(s)

Create and put this .htaccess file in your laravel installation(root) folder.

 

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Answered on July 5, 2020.
Add Comment

Give ownership to www-data:

sudo chown -R www-data:www-data /var/www/html/your-laravel-project

Answered on July 5, 2020.
Add Comment

Then set the right folder and file permissions using the commands below:

sudo find /var/www/html/your-laravel-project -type f -exec chmod 644 {} \;

sudo find /var/www/html/your-laravel-project -type d -exec chmod 755 {} \;

Answered on July 5, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.