thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.78k stars 2.67k forks source link

404 error on all Voyager Images #5494

Open shaniemartin opened 2 years ago

shaniemartin commented 2 years ago

Laravel version

8.73.1

PHP version

8.0.12

Voyager version

1.5.2

Database

MySQL 5.7

Description

Voyager images in storage folder are giving a 404 error when uploaded to live server. I am serving my laravel project on cpanel with my project in a seperate folder (/home/username/mysitename) and the contents of my public file have been moved to (home/public_html). I have created a sym link between (home/username/mysitename/storage/app/public) and (home/username/public_html/storage). I have deleted the folder and re run the storage:link command a number of times to make sure as instructed in other posts.

This is my filesystem data: 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => '/storage', 'visibility' => 'public', ],

I updated the url to remove the env(APP_URL). as instructed by voyager troubleshooter docs as I am serving on https.

Files are saving to the correct place in storage, and can be accessed and opened in file manager via the sym link to public_html.

The image source in the front end is correct e.g. https://mysitename.co.uk/storage/users/November2021/filename.jpg. However I am getting a 404 Failed to load resource error. I cannot seem to access the image no matter how I fiddle with the url to try and troubleshoot the problem.

Steps to reproduce

Laravel 8.73.1 Voyager 1.5.2 Upload project to live server. Upload image through voyager.

Expected behavior

Image appears without error on the frontend.

Screenshots

No response

Additional context

No response

howdu commented 2 years ago

If you look inside the public folder is the storage symlink linked correctly?

Otherwises create it manually eig ln -s /home/cpanel_username/project_name/storage/app/public /home/cpanel_sername/project_name/public/storage

But it's more of a Laravel setup issue than anything wrong with Voyager.