How to setup laravel file permission once and for all How to setup laravel file permission once and for all laravel laravel

How to setup laravel file permission once and for all


Give this a try:

# give the newly created files/directories the group of the parent directory # e.g. the laravel groupsudo find $project_Path/bootstrap/cache -type d -exec chmod g+s {} \;sudo find $project_Path/storage -type d -exec chmod g+s {} \;# let newly created files/directories inherit the default owner # permissions up to maximum permission of rwx e.g. new files get 664, # folders get 775sudo setfacl -R -d -m g::rwx ./storagesudo setfacl -R -d -m g::rwx ./bootstrap/cache


how 'bout sudo chown -R $USER:$USER * on your root of laravel project folder?
or
sudo chown -R $USER:$USER [laravel folder name] if you're outside/ in parent directory of you're laravel folder / project ?


Option 1 add www-data group to my-user:

sudo adduser www-data my-user

Option 2 change user of php-fpm into my-user (ref):

find options user and group in www.conf, and change it into [my-user] group=mygroup