Created
January 31, 2020 09:48
-
-
Save Frolki1-Dev/2dc87b3ea1380e294b44846124f81145 to your computer and use it in GitHub Desktop.
Setup Laravel file and directory permission for deployment on production
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
#!/bin/bash | |
echo "Setup the permission for Laravel project." | |
echo "Laravel base directory is $1" | |
echo "" | |
echo "Set owner to www-data" | |
chown -R www-data:www-data $1 | |
echo "" | |
echo "Set all files to 644" | |
find $1 -type f -exec chmod 644 {} \; | |
echo "" | |
echo "Set all direcotries to 755" | |
find $1 -type d -exec chmod 755 {} \; | |
echo "" | |
echo "Correct the permission for the cache" | |
chgrp -R www-data $1/storage $1/bootstrap/cache | |
chmod -R ug+rwx $1/storage $1/bootstrap/cache | |
echo "" | |
echo "Setup finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment