1
votes

The project is running fine on local but on web server (running on sub domain) when I created symlink using php artisan storage:link or even ln -s full_path/storage/app/public full_path/public/storage through ssh, the symlink got created but I still can't access images inside my storage/app/public without "app/public" eg: I can access http://xyz.abc.com/storage/app/public/35/conversions/retro1-thumb.jpg but I can't access http://xyz.abc.com/storage/35/conversions/retro1-thumb.jpg

What I have already tried:

  1. Deleted storage and ran php artisan storage:link - no help
  2. Updated htaccess to follow symlink in root and public - no help
  3. Run php artisan config:clear , php artisan config:cache, php artisan cache:clear - no help
  4. Updated config/filesystem.php with real path as storage and url - no help
  5. Approached host support - no help
  6. Did extensive google search - no help

Here's my config/filesystems.php disk conf-

'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'),
        ],

    ],

Hope it can be resolved.

1
Can you post your config file? You shouldn't be able to access files through the /storage/app/public path at all, that directory is not supposed to be directly accessible. That's why the symlink is necessary in the first place.Alec Joy
@AlecJoy You mean config/app.php ?Prateek Asthana
No, config/filesystems.php, particularly the public disc portionAlec Joy
@AlecJoy Updated the answer with filesystems.php disc confPrateek Asthana
Where is your webroot pointed in your nginx or apache config? Something isn't right here, you should not be able to directly access the /storage/app folder in the browser. It's a level up from the public folder. If that folder is accessible, so are all your php filesAlec Joy

1 Answers

2
votes

try the following:

1.) config/filesystems.php change root

2.) in public folder , remove storege folder and run php artisan storage:link

3.) Check if symbolic link is enabled in your server