laravel - laravel 存储文件夹的服务器前提重置
问题描述
我有一个问题,我的存储文件夹上的服务器前提每 2 天重置一次。所以我运行这些命令并得到修复:
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
chmod -R 775 storage
chmod -R 775 bootstrap/cache
问题是错误再次出现,如下所示:
the stream or file could not be opened in append mode: failed to open stream: permission denied
所以在运行存储之前拥有:
drwxrwxrwx 6 www-data www-data 4096 Nov 7 02:00 storage
之后
drwxrwxr-x 6 root www-data 4096 Nov 7 02:00 storage
解决方案
这是因为 git。例如git pull
,当运行时,它将文件的所有者更改为 root 用户。您可以通过 www-data 用户运行 git 命令,或者在每个 git 命令之后将文件的所有者更改为 www-data。
git pull
作为 www-data 用户的示例
sudo -u www-data git pull origin master
推荐阅读
- mysql - 联接三个表,以便可以替换多个列值
- dpdk - DPDK网卡收不到对方的任何数据
- php - 使用 laravel @forelse 检测“错误”并停止循环
- angularjs - AngularJS 配置在缩小时会导致错误
- html - HTML 代码的哪一部分用于抓取网站表格
- python - aws Sagemaker 的 AnnotationConsolidation lambda 事件上的空字典
- python - 如何获取iframe 元素内部的值
- mysql - 尝试更新数据库中的列但 NOT NULL 属性不允许我更新值。我正在使用 Laravel
- c++ - C++ 优化 Binay 文件的读取
- web - 服务器对象错误“ASP 0177:800aea5f Server.CreateObject 失败