Vranvs
Vranvs

Reputation: 1521

Laravel 404 Not Found, but image path is correct

I recently deployed my Laravel application to a VPS that I purchased, and have (I think) one final error to resolve. After uploading an image, the image is successfully uploaded and stored in the storage directory, but the browser throws a 404 error.

I have run php artisan storage:link on my VPS. I have verified that it indeed is linking public/storage/ to storage/app/public/ by checking in my FTP client as well as via SSH.

I should also note, other images load just fine. It is only images in my storage/... folder.

The code runs just fine on my local production server, and path is exactly the same. For this reason, it makes me think there is a permission error and thats why I haven't pasted any code, but am more than happy to share it if it helps. It is loaded dynamically with jQuery so I thought just showing the GET request would be of more use.

Is there perhaps an environment variable or permission that I have neglected to set after deployment?

enter image description here

Upvotes: 7

Views: 10349

Answers (1)

Seva Kalashnikov
Seva Kalashnikov

Reputation: 4392

File permissions issue..

From you project folder run

sudo chmod 775 -R storage

And make sure your symlink public/storage have an appropriate read permission

Upvotes: 7

Related Questions