Press "Enter" to skip to content

How to set up the Permission on Laravel file structure.


Permissions are usually denoted with three digits, each representing a different set of permissions:

  • The first digit represents permissions for the user who owns the file (user permissions).
  • The second digit represents permissions for the group that owns the file (group permissions).
  • The third digit represents permissions for all other users (world permissions).

Each digit can be a number from 0 to 7, which corresponds to a combination of read (4), write (2), and execute (1) permissions. For example, a permission of 755 means that the user can read, write, and execute (4+2+1=7), while the group and others can read and execute but not write (4+1=5).

Steps to Set Up File Permissions in Laravel

Step 1: Setting the Owner and Group

$ sudo chown -R www-data:www-data /path/to/your/laravel/app

Step 2: Setting Directory Permissions

$ find /path/to/your/laravel/app -type d -exec chmod 755 {} \;

Step 3: Setting File Permissions

$ find /path/to/your/laravel/app -type f -exec chmod 644 {} \; 

Step 4: Special Permissions for Storage and Bootstrap/Cache Directories

$ sudo chmod -R 775 /path/to/your/laravel/app/storage 
$ sudo chmod -R 775 /path/to/your/laravel/app/bootstrap/cache 
How to see the exact IP Address when using cloudflare?