in laravel, unix

Setting folder permissions and ownership for Laravel projects

If the web server is running as different user / group, change www-data accordingly.

# add current user to www-data group.
sudo usermod -aG www-data $USER

cd /path/to/laravel/repo

sudo chown -R $USER:www-data .
sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

In case the permissions / ownerships are messed up, you can execute the scripts to reset.

Write a Comment