I am using the default laravel folder structure and the filesystem public
:
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
Everything runs on docker and the complete laravel folder is mounted into /var/www/html
:
#... Laravel PHP-FPM service definition
volumes:
- "./:/var/www/html"
#...
When I run php artisan storage:link
and then cd /var/www/html/public
and ls -la
I see that the symlink exists:
lrwxr-xr-x 1 root root 32 May 5 11:19 storage -> /var/www/html/storage/app/public
If i then check to see if the linked folder also exists in the container cd /var/www/html/storage/app/public
everything is there as expected.
Also, when checking ls -la /var/www/html/public/storage/
directly it shows me the content of the linked folder. So everything is working from symlink perspective
# ls -la /var/www/html/public/storage/
total 512
drwxr-xr-x 4 www-data www-data 128 May 5 11:21 .
drwxr-xr-x 11 www-data www-data 352 Apr 19 14:03 ..
-rw-r--r-- 1 www-data www-data 14 Feb 16 16:58 .gitignore
-rw-r--r-- 1 www-data www-data 519648 May 5 10:58 sample.png
However, when opening the url /storage/sample.png
the server returns 404.
The remaining contents of /var/www/html/public
do work fine, so for example /var/www/html/public/test.png
is visible under localhost/test.png
.
On production, everything works fine though. Any ideas why the symbolic link is not working on the local system while the link is actually correct?
I already tried removing the storage link and setting the symlink again.
disable_symlinks off;
tonginx.conf
http
directive if that is what you are referring to. Still does not work though.storage -> ../storage/app/public/
but still 404 unfortunately. thanks mysterious tom