仅 Laravel 存储目录出现 403 错误
我当前在存储目录上收到 403 错误。
我已经尝试了 php artisan 链接和命令行中的常规符号链接的正确文件路径 具体路径是这个:
http://example.com/storage/app/public/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
这个链接到存储目录: 到这里:example.com/public/storage/*
我像这样创建了符号链接:
ln -s /var/www/vhosts/example.com/httpdocs/storage /var/www/vhosts/mydomain.com/httpdocs/public
上面的目录用于符号链接,但对于 php artisan 链接,url 略有不同。
之前为存储设置的权限被执行运行:
chmod -R 775 storage/
检查权限我得到这个:
ls -la ./httpdocs
drwxr--r-- 5 pacer psacln 46 Apr 8 2021 storage
除了存储目录之外,其他一切都有效。我已经看到了有关 403 的其他问题,并尝试了这些修复,但没有任何效果。知道我做错了什么吗?
I'm currently getting a 403 error on the storage directory.
I have tried the correct file path for both a php artisan link and the regular symlink from command line
The specific path is this one:
http://example.com/storage/app/public/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
This is linked to the storage directory:
to here: example.com/public/storage/*
I created the symlink like so:
ln -s /var/www/vhosts/example.com/httpdocs/storage /var/www/vhosts/mydomain.com/httpdocs/public
The above directory is for the symlink one but for php artisan link the url is slightly different.
the permissions set for storage before were executed running:
chmod -R 775 storage/
checking permissions I get this:
ls -la ./httpdocs
drwxr--r-- 5 pacer psacln 46 Apr 8 2021 storage
Everything else works except the storage directory. I've seen the other questions regarding 403 and have attempted those fixes but nothing is working. Any idea what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
存储链接直接指向“app/public”文件夹。
所以链接地址将如下所示:
The storage link points directly to the "app/public" folder.
So the link address will look like this :
花了一段时间后,由于我使用 root 运行了 php artisan storage:link 和 ln -s link ,导致了错误。因此,我的服务器无法访问该链接以供公众使用。
我的解决方案是切换到用户:
然后运行 php artisan storage:link
After a while spent on this the error was caused because I ran the php artisan storage:link and ln -s link with root. Therefore the link was unaccessible by my server for public consumption.
My solution was to switch to user:
Then run the php artisan storage:link
首先:运行commit
first : run commint