unable to retrieve images uploaded on aws instance using laravel

i am trying to upload image via laravel and then retrieve its url to save in database and return back to the front end application , image upload is working fine at localhost but not at ec2 instance .

Image is uploaded successfully and can be downloaded via filezilla also

i have setup chmod -R 777 for the storage directory in laravel but its still not working

public static function upload_files($type, $file, $id)

{
    if ($type == 'profile_pic') {
        $image = $file->store('profile_pic','public');
         $image = asset('storage/'.$image);
        if ($image) {
            return $image;
        } else {
            return false;
        }
    }
}

it return http://localhost/trip/public/storage/profile_pic/MaHskQD2VcLSlC11VV3agbBNdh7j7k82liewYBw3.pngat localhost and when i click on the link, image is loaded successfully while on my server it loadshttp://mydomain/storage/app/profile_pic/MaHskQD2VcLSlC11VV3agbBNdh7j7k82liewYBw3.png and throws 404 not found error

result of ls -lrt is "-rwxrwxrwx 1 apache ec2-user 190916 Jan 23 10:06 MaHskQD2VcLSlC11VV3agbBNdh7j7k82liewYBw3.png"

#laravel #image #Amazon-Web-Services

3 Likes1.85 GEEK