如何解决在Laravel文件夹中访问存储的问题。

huangapple go评论70阅读模式
英文:

How to solve the problem of accessing the storage in Laravel folder

问题

遇到了访问存储文件夹的问题。创建了一个符号链接,但当我尝试访问存储文件夹中的任何文件时,出现了403错误:“您无权访问此对象。文件不可读取,或服务器无法读取它。”我在本地机器上有第二个项目,那里一切正常。我尝试将存储文件夹的权限设置为777,但这导致了“权限被拒绝”错误。我将对任何帮助感到高兴!
MacOS Catalina

英文:

Faced a problem accessing the storage folder. A symbolic link was created, but when I try to access any file in the storage folder, I get an error 403 "You do not have permission to access this object. The file is not readable, or the server cannot read it." I have a second project on a local machine, everything works fine there. I tried to give 777 permissions to the storage folder, but this causes the "Permisson denied" error. I will be glad to any help!
Macos catalina

答案1

得分: 1

Laravel权限

首先将laravel目录的所有权更改为我们的Web组。

sudo chown -R :www-data /var/www/laravel

接下来,我们需要为Web组授予对我们的存储目录的写权限,以便它可以写入此文件夹。

sudo chmod -R 775 /var/www/laravel/storage

> 这里的 laravel 是根目录的名称。

英文:

Laravel Permissions

first change ownership of the laravel directory to our web group.

sudo chown -R :www-data /var/www/laravel

Next we need to give the web group write privileges over our storage directory so it can write to this folder.

sudo chmod -R 775 /var/www/laravel/storage

> where laravel is the name of the root

huangapple
  • 本文由 发表于 2020年1月3日 22:00:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579869.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定