Vagrant Homestead的“存储"文件夹权限被拒绝 [英] Vagrant Homestead 'storage' folder permission denied

查看:545
本文介绍了Vagrant Homestead的“存储"文件夹权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Homestead上运行Laravel会出现以下错误:

Running Laravel on Homestead gives the following errors:

流或文件"/var/www/laravel/storage/logs/laravel.log"可以 无法打开:无法打开流:权限被拒绝

The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

现在,我了解到存储的权限不正确,但是尝试以下操作无效:

Now I understand that the permission for storage is not correct but trying the following didn't work:

  • 在来宾VM中设置文件权限-不起作用
  • 更改主机上的文件权限(在本例中为Windows)-不起作用
  • 最后,将以下内容添加到Vagrantfile中更改了存储文件夹的所有者,但仍然出现相同的错误: config.vm.synced_folder "~/project/storage", "~/project/storage", owner: "www-data", group: "www-data"
  • Setting file permissions in the guest VM - didn't work
  • Changing file permission on the host machine (windows in this case) - didn't work
  • Lastly, Adding the following to the Vagrantfile changed the owner of the storage folder but still gives the same error: config.vm.synced_folder "~/project/storage", "~/project/storage", owner: "www-data", group: "www-data"

我不确定下一步该怎么做.任何帮助将不胜感激.

I'm not sure what to do next. Any help would be greatly appreciated.

谢谢.

推荐答案

对我来说,将Laravel与Homestead结合使用时,我没有任何权限问题;它开箱即用.

For me, I didn't have any permission issues when using Laravel with Homestead; it worked out of the box.

无论如何,通过SSH进入您的Vagrant计算机,移至项目的根目录并运行以下命令.

Anyway, SSH into your Vagrant machine, move towards the project's root and run the following commands.

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

这篇关于Vagrant Homestead的“存储"文件夹权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆