简体   繁体   中英

Laravel Symlink between storage and public is not working?

So I am having issues adjusting from a locally hosted Laravel website to a dedicated server.

I ran this code on Putty to create a symlink. And I think it works as I can see the folder in the Filezilla client.

ln -s /home/username/project/storage/app/public/receipts /home/username/public_html/storage/

The issue is I cannot access any files stored in the folder. If I cd into the folder in shell i can see all the files there. If I put an image in the public_html/storage folder I can see it by going to website.com/storage/image.jpg but the same image in the app/public/receipts folder does not open when I try website.com/storage/receipts/image.jpg

Also I checked the global configuration for the apache server for allowsymlinks and is checked.

This the first time I've ever tried anything to do with servers so I don't really know what I am doing. Any help would be appreciated.

My Php Version is 7.2 Laravel is 5.6

Not sure if it's a typo, but the target to your link is .../public/receipts . It seems as though you wanted .../public instead:

ln -s /home/username/project/storage/app/public /home/username/public_html/storage

This way, website.com/storage/image.jpg would point to .../app/public/image.jpg and website.com/storage/receipts/foo.jpg would point to .../app/public/receipts/foo.jpg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM