问题描述
我正在使用laravel 5.5的存储符号链接来存储图像.当我将代码推送到git并从实时站点提取时,实时站点上的symlink路径将与本地代码相同.我的本地人有此符号链接
I am using laravel 5.5's storage symlink to store images. When I push code to the git and pull from live site then symlink path on live site becomes same as is on my local code .My local has this symlink
storage -> /home/path/to/project/app/public/
但实际网站需要此符号链接路径
But live site expects this symlink path
storage -> /var/www/html/website.com/public_html/project_code/storage/app/public/
每次我都必须删除符号链接,然后在实时站点上再次创建它.我已经在直播网站上执行了这些步骤
Every time I have to delete symlink and create it again on live site.I have do these steps on live site
cd public
rm storage
cd ..
php artisan storage:link
完成这些步骤后,我的符号链接将根据实际站点显示,然后开始工作.实时网站应具有此符号链接
after doing these steps my symlink becomes according to live site and then it starts working.Live site should have this symlink
storage -> /var/www/html/website.com/public_html/project_code/storage/app/public/
project_code/.gitignore:
project_code/.gitignore :
public/storage
project_code/storage/app/.gitignore
project_code/storage/app/.gitignore
*
!public/
!.gitignore
我如何摆脱这个问题.
How I can get rid of this issue.
提前谢谢!
推荐答案
当符号链接指向项目目录结构中的另一个位置时,您可以安全地使用相对路径进行链接,而不必使用绝对路径(正在设置).不过,这将需要手动链接(如果已经在app/public
中删除了当前链接):
As your symlink points to another location within the project directory structure, you can safely use relative path for link, instead of having absolute one (which is what artisan
is setting up). That would require manual linking though (remove current link if you have it in app/public
already):
cd app/public
ln -s ../storage/app/public storage
这篇关于将代码推送到活动站点时,laravel symlink发生更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!