Give Correct File Permission in Lararvel App in Production

Hello Artisan,

In this tutorial, I will discuss laravel file permissions ubuntu server. You know that file permission is the most important part of protecting your software from hackers. This tutorial will give you a simple example of laravel folder permissions.

You will learn from this tutorial that, how to set storage folder permissions in laravel. Let's discuss about laravel storage permission denied ubuntu server or any linux server. We will do the following things for how to set up file permissions for laravel.

It is important to give the right file permission in laravel application in production.  Let's see the example command: 

Here, we will give 755 permission to storage and bootstrap folder. let's run the below commands:

sudo chmod -R 755 bootstrap/cache
sudo chmod -R 755 storage

 

Here, we will give file permission with the www-data user. let's follow the below command:

sudo chown -R www-data:www-data /var/www/your-project-path

 

Here, set 644 permission for all files and 755 for all directories. run below command.

sudo find /var/www/your-project-path -type f -exec chmod 644 {} \; 
sudo find /var/www/your-project-path -type d -exec chmod 755 {} \; 

 

Hope this tutorial will help you.

 

author-image
Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js