【发布时间】:2022-01-21 08:36:44
【问题描述】:
我正在使用 laravel 8,但出现存储错误:
"存储路径
/var/www/type.adoreanime.com/htdocs/Linkati/storage/app不是一部分 公共路径/var/www/type.adoreanime.com/htdocs/Linkati/public(看法: /var/www/type.adoreanime.com/htdocs/Linkati/resources/views/layouts/master.blade.php) (看法: /var/www/type.adoreanime.com/htdocs/Linkati/resources/views/layouts/master.blade.php) (看法: /var/www/type.adoreanime.com/htdocs/Linkati/resources/views/layouts/master.blade.php) ◀"
我运行 nginx 作为我的网络服务器,所以我将 /var/www/type.adoreanime.com/htdocs/Linkati/public 设置为根目录。
文件系统.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
's3_public' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'visibility' => 'public',
],
],
];
有人知道如何解决这个问题吗?
【问题讨论】:
-
您是否运行
php artisan storage:link命令在您的公共目录中生成符号链接? -
@Rwd 我刚试过,但错误仍然存在
-
你在使用 Spatie 媒体库吗?
-
@Rwd 是的,我正在使用它