When you are working on a laveral 5 project and are using apache web server that has the owner set to _www:_www, you should know what is the best method to set up file permissions for Laravel?
The /storage folder must be readable for Laravel 5.
The official Laravel documentation for file permission says the following:
Laravel may require some permissions to be configured: folders within and require write access by the web server.
The below article will discuss how you can set up file permissions and ownership in detail for Laravel in detail:
How to set up file permissions for Laravel?
To set up file permissions for Laravel, either you can make Webserver as the owner or you could set yourself as the owner. both ways you have to give webserver access to read and write for storage and cache.
Your ownership and permissions can be set up in one of two ways, essentially. Either you grant yourself ownership of all files, or the webserver becomes the sole owner.
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.
https://laravel.com/docs/5.4/installation#configuration

Below are the methods to set the file permissions for Laravel:
Method 1: Setting the Webserver as the Owner
Setting the Webserver as the Owner is the most commonly used method and this is the mentioned way in the Laravel documentations as well.
The below example assumes that “www-data” is the webserver user you are using in your project.
Follow the code mentioned below first:
sudo chown -R www-data:www-data /path/to/your/laravel/root/directory
If you run the above code, the webserver will be the group and owner of all files, causing you to experience difficulties when using FTP to upload or deal with files because your user will be logged in as you, not the webserver, so make sure to add your user to the webserver user group by following the code mentioned below:
sudo usermod -a -G www-data ubuntu
The aforementioned example assumes that your user is ubuntu and that your webserver is operating as www-data, which is the Homestead default.
The next step will be to set your files to 644 and all of your directories to 755. To set file permissions follow the code mentioned below:
sudo find /path/to/your/laravel/root/directory -type f -exec chmod 644 {} \;
To set directory permissions follow the code mentioned below:
sudo find /path/to/your/laravel/root/directory -type d -exec chmod 755 {} \;
Method 2: Set User as Owner
Many developers find Set User as Owner method for Laravel file permission much easier to work with everything when they own all the directories and files.
To do so go to your laravel root directory by following the path mentioned below and then follow the code mentioned below the guide:
cd /var/www/html/laravel >> In the event that this is your current root directory
sudo chown -R $USER:www-data
Finally you will have to give yourself and the webserver permissions by following the code mentioned below:
sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;
NOTE: Giving the webserver access to read and write to storage and cache would be the final Step.
Whichever method you may have used above, You will have to give the webserver access to read and write to storage and cache.
Run the below mentioned commands from bashy to provide the webserver read and write permissions for storage, cache, and any other folders the webserver needs to upload to or write to:
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Now that your website is operational and you are protected, you can work with the files reasonably effortlessly.
This should help you undestand how to set up file permissions for Laravel.
Conclusion
To set up file permissions for Laravel, either you can make Webserver as the owner or you could set yourself as the owner. both ways you have to give webserver access to read and write for storage and cache.