file_put_contents(/ path / to / cache)无法打开流:权限被拒绝

问题描述 投票:0回答:1

[即时通讯测试时如何摆脱这些烦人的消息?它经常出现why声即时编码,每次我应该执行sudo chmod 777 -R storage /或类似的东西

Laravel 7.4

php linux laravel permissions artisan
1个回答
0
投票

大多数文件夹应该是正常的“ 755”,文件应该是“ 644”

Laravel要求Web服务器用户可写一些文件夹。您可以在基于* nix的操作系统上使用这些命令。

使用ACL

// nginx = Web服务器用户// systemuser =您用于通过ssh登录的本地用户

sudo setfacl -Rdm u:nginx:rwx,u:systemuser:rwx storage
sudo setfacl -Rm u:nginx:rwx,u:systemuser:rwx storage

如果没有ACL,则可以使用它们,但它们并不怎么好;

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

来源:https://laracasts.com/discuss/channels/general-discussion/laravel-framework-file-permission-security

© www.soinside.com 2019 - 2024. All rights reserved.