I'm working with a custom file storage disk and it works as expected on my local machine, but on my Forge server the generated asset URLs don't work.
My filesystem config looks like this:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'assets' => [
'driver' => 'local',
'root' => storage_path('app/public/assets'),
'url' => env('APP_URL').'/assets',
'visibility' => 'public',
],
];
I have a file at {myapp root}/storage/app/public/assets/file.jpg
and I'm generating URLs with Storage::disk('assets')->url('file.jpg');
and this works fine, it gives me the expected URL, which is (locally) myapp.test/assets/file.jpg
. In production I get the correct URL as well, myapp.com/assets/file.jpg
, but this link 404s. If I insert "storage" into the URL, so that it's myapp.com/storage/assets/file.jpg
, it works.
I've php artisan storage:link
ed everything in both environments, everything else is exactly the same, but on a real server the URLs all 404.
Help!!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire