How to setup Laravel ownership and permissions on Linux
There are basically two ways to setup your ownership and permissions. Either you give yourself ownership or you make the webserver the owner of all files.
Webserver as owner (the way most people do it, and the Laravel doc's way):
assuming http (it could be something else) is your webserver user.
if you do that, the webserver owns all the files, and is also the group, and you will have some problems uploading files or working with files via FTP, because your FTP client will be logged in as you, not your webserver, so add your user to the webserver user group:
Of course, this assumes your webserver is running as http, and your user is andrei.
Then you set all your directories to 755 and your files to 644... SET file permissions
SET directory permissions
Your user as owner
I prefer to own all the directories and files (it makes working with everything much easier), so, go to your laravel root directory:
Then I give both myself and the webserver permissions:
Then give the webserver the rights to read and write to storage and cache
Whichever way you set it up, then you need to give read and write permissions to the webserver for storage, cache and any other directories the webserver needs to upload or write too (depending on your situation), so run the commands from bash above:
Now, you're secure and your website works, AND you can work with the files fairly easily