gecche / laravel-multidomain

A Laravel extension for using a laravel application on a multi domain setting
MIT License
838 stars 105 forks source link

Public storage issue #109

Closed FlorianRhonalpcom closed 6 months ago

FlorianRhonalpcom commented 6 months ago

Hi, I followed the steps to use distinct symbolic link for each domain but i don't have access to my files. The file is stored in the correct folder, but I cannot display it.

My files :

.env.domain.test with
APP_URL= https://domain.test/
and
APP_PUBLIC_STORAGE=-domain_test

filesystems.php

'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage'.env('APP_PUBLIC_STORAGE'),
'visibility' => 'public',
],

In my folder /public lrwxrwxrwx 1 p4552 www-data 45 Feb 19 21:22 storage-domain_test-> storage/domain_test/app/public

In my blade template <img src="{{ asset('storage'.env('APP_PUBLIC_STORAGE').'/'.$image) }}"> The URL : https://domain.test/storage-domain_test/image.png

The image exists in my folder /storage/domain_test/app/public/image.png but not showing up. And when i tried to access to the URL, i have a 403 Forbidden

Thanks

gecche commented 6 months ago

Hi,

I've just done a manual test in my pc and it works fine.

I've just two observations on your code:

1 - the link lrwxrwxrwx 1 p4552 www-data 45 Feb 19 21:22 storage-domain_test-> storage/domain_test/app/public does not seem right because the real storage folder should be one level up, maybe should be ../storage/domain_test/app/public but in the shell the symbolic link is ok? Or it is broken?

2 - the permissions of the image file are right?

Let me know

Cheers

Giacomo

FlorianRhonalpcom commented 6 months ago

Thanks Giacomo,

1 - the link lrwxrwxrwx 1 p4552 www-data 45 Feb 19 21:22 storage-domain_test-> storage/domain_test/app/public does not seem right because the real storage folder should be one level up, maybe should be ../storage/domain_test/app/public but in the shell the symbolic link is ok? Or it is broken?

This is right. The problem came from the symbolic link, I had to use the full path of my folders Work for me ln -s /home/www/myApp/storage/site1_com/app/public /home/www/myApp/public/storage-site1_com