【Laravel】新規作成時のパーミッション設定

Laravelで新規にサイト作ろうとすると
パーミッションで怒られるはず、、、

やり方は、いくつかあるけど
この方法が自分好みなので、メモメモ

おおざっぱな手順
 ・[laravel] グループを新規に作成して
 ・[apache] など必要なユーザを [laravel] グループに追加する
 ・[storage] 配下 の所有グループを [laravel] に変更
 ・新規で作成されるファイルのパーミッションを指定

# groupadd laravel
# gpasswd -a apache laravel

# chown -R :laravel ./storage

# find ./storage -type d -exec chmod 775 {} \;
# find ./storage -type f -exec chmod 664 {} \;

# find ./bootstrap/cache -type d -exec chmod 775 {} \;
# find ./bootstrap/cache -type f -exec chmod 664 {} \;

# find ./storage -type d -exec chmod g+s {} \;
# find ./bootstrap/cache -type d -exec chmod g+s {} \;

# setfacl -R -d -m g::rwx ./storage
# setfacl -R -d -m g::rwx ./bootstrap/cache

以上!

コメント

タイトルとURLをコピーしました