Laravel 5.6符号链接问题,404 Not Found,但路径确实存在

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

我最近将我的Laravel应用程序部署到具有ssh访问权限的共享托管服务器,在我的本地机器上,每件事情都完美无缺。但服务器返回以下错误:

无法加载资源,服务器响应状态为404(未找到)

对于存储在laravel_directory / storage / app / public / i中的图像,通过运行成功创建了指向public_html / storage的符号链接

ln -sfv / home / dtruxpgw / repositories / SoukElfalah / storage / app / public / storage

从public_html目录我也试过了

ln -s / home / dtruxpgw / repositories / SoukElfalah / storage / app / public / home / dtruxpgw / public_html / storage

ln -s / home / dtruxpgw / repositories / SoukElfalah / storage / app / public / home / dtruxpgw / public_html

我也跑了

php artisan storage:链接

chmod 775 -R存储

当我跑

ls -la / home / dtruxpgw / public_html / storage

我明白了

lrwxrwxrwx 1 dtruxpgw dtruxpgw 59 Feb 27 09:04 / home / dtruxpgw / public_html / storage - > / home / dtruxpgw / repositories / SoukElfalah / storage / app / public /在cPanel中存储文件存在并链接到laravel_directory / storage / app / public /这里是html代码

<img class="card-img-top thumbnail" src="{{$img_name?asset('/storage/images/thumbs/'.$img_name) : asset('/storage/images/thumbs/default.png')}}" alt="{{$img_name}}">

我已经在这里堆了两天了,任何帮助我真的很感激,谢谢你提前。

the error indicating the image not found but it exist  here the storage symbolic link successfully created

laravel storage symlink
2个回答
0
投票

您错过了一件事是您无法直接从存储文件夹访问文件系统,如上所述。如果要访问它,请公开上传您的文档在公共目录中。

您只能通过路由访问存储文件夹中的文件。


0
投票

将带有图像的thumb文件夹移动到public/img并删除符号链接。这样做是没有意义的。无论公开的是什么都应该在公众面前为什么要将图像存储到存储文件夹中?

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