简体   繁体   English

Laravel Voyager Avatar 未在 AWS EC2 中显示

[英]Laravel Voyager Avatar not showing in AWS EC2

AWS EC2 is not showing the avatar in Laravel Voyager. AWS EC2 未在 Laravel Voyager 中显示头像。 Typically when this kind of error pop ups in local server we used to change the APP_URL in .env to fix the problem.通常,当本地服务器中出现此类错误时,我们通常会更改 .env 中的 APP_URL 以解决问题。

But I have no idea now in the case of AWS EC2.但我现在不知道 AWS EC2 的情况。 I think it's the problem with reading/writing permission, when I inspect the console it shows a 404 error for the image path.我认为这是读/写权限的问题,当我检查控制台时,它显示图像路径的 404 错误。 When I check the path the user/default.png (folder and fie) doesn't exist in the storage folder of server.当我检查路径时,服务器的存储文件夹中不存在 user/default.png(文件夹和 fie)。 I tried manually creating user and file using FileZilla FTP, and tried calling it.我尝试使用 FileZilla FTP 手动创建用户和文件,并尝试调用它。 Still it returns a 404.它仍然返回 404。

在此处输入图片说明

在此处输入图片说明

  1. delete storage short-link in public directory if it exists.删除公共目录中的存储短链接(如果存在)。
  2. remake a new link with artisan command (php artisan storage:link)使用 artisan 命令重新创建一个新链接(php artisan storage:link)
  3. confirm that the APP_URL={your domain}确认 APP_URL={your domain}
  4. php artisan config:cache php工匠配置:缓存
  5. re-run the server重新运行服务器

It always worked for me.它总是对我有用。

for local host, try对于本地主机,请尝试

Updated .env file:更新的 .env 文件:

APP_URL= http://localhost:8000 APP_URL= http://localhost:8000

then然后
php artisan config:cache php artisan cache:clear

Change the permission of the root folder (in this case /var/www/html) to 775将根文件夹(在本例中为 /var/www/html)的权限更改为 775

Then run the commands php artisan vendor:publish然后运行命令php artisan vendor:publish

Found the answer with the help of Git Hub Collaborator support.在 Git Hub Collaborator 支持的帮助下找到了答案。 ( https://github.com/the-control-group/voyager/issues/3917 ) ( https://github.com/the-control-group/voyager/issues/3917 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM