如何为生产或子域系统创建laravel存储符号链接? [英] How to create laravel storage symbolic link for production or sub domain system?
问题描述
当我在laravel本地开发服务器上工作时,php artisan storage:link
对我来说工作正常.但是,当我将站点转移到生产服务器时,我看到我的公共存储链接是一个文件夹.然后删除尝试创建链接的链接.我收到了一个错误消息,因为我的应用程序位于根文件夹中,并试图解决此问题.
When I worked on laravel local development server php artisan storage:link
works fine for me. But when I transfer my site to production server then I saw my public storage link was a folder. Then I delete that tried to create a link. I got an error because my app was in the root folder and tried to solve this problem.
推荐答案
我通过另一个通过terminal/cmd/shh创建符号链接的命令解决了这个问题:
I solved this problem by another command for creating a symbolic link by terminal/cmd/shh:
ln -s /path/to/laravel/storage/app/public /path/to/public/storage
我也使用laravel网络路线route/web.php解决了这个问题
I solved this also Using laravel web route routes/web.php
Route::get('/foo', function () {
Artisan::call('storage:link');
});
这篇关于如何为生产或子域系统创建laravel存储符号链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!