Last active
November 8, 2020 08:19
-
-
Save ezequiel9/f44d0354eca8f21e0fd0cc0f60cf89eb to your computer and use it in GitHub Desktop.
How to proper set up Laravel Permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your user as owner | |
I prefer to own all the directories and files (it makes working with everything much easier), so I do: | |
# sudo chown -R my-user:www-data /path/to/your/laravel/root/directory | |
Then I give both myself and the webserver permissions: | |
# sudo find /path/to/your/laravel/root/directory -type f -exec chmod 664 {} \; | |
# sudo find /path/to/your/laravel/root/directory -type d -exec chmod 775 {} \; | |
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 bashy above : | |
# sudo chgrp -R www-data storage bootstrap/cache | |
# sudo chmod -R ug+rwx storage bootstrap/cache | |
Now, you're secure and your website works, AND you can work with the files fairly easily |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment