[英]Laravel deployment cache until server restart
当我使用Capistrano将Laravel 4.2.9应用程序部署到Ubuntu 14.04服务器时,似乎所有的php文件都被PHP,Laravel或Nginx缓存了。 我必须手动重新启动服务器才能破坏缓存并查看我的任何更改。
Capistrano在服务器上创建一个新的发行目录,并在其中运行git checkout
以获取上一个标记的版本。 部署完成后,“当前”符号链接将更新为指向新的发行目录。 唯一共享的文件是我的上载目录和环境设置文件。
我尝试过的事情:
php artisan cache:clear
composer dump-autoload
只有在部署后手动重新启动服务器才能破坏高速缓存,这会带来停机时间(对于该服务器上托管的其他站点也是如此)和额外的风险。
有人建议这可能是Nginx,PHP还是Laravel本身?
在部署Laravel 5应用程序时,我遇到了类似的问题,并且似乎通过在Capistrano的deploy.rb末尾添加以下内容解决了该问题:
namespace :deploy do
desc "Build"
after :updated, :build do
on roles(:web) do
within release_path do
execute :composer, "install --no-dev --quiet"
execute :php, "artisan clear-compiled"
execute :php, "artisan cache:clear"
execute :php, "artisan view:clear"
execute :php, "artisan twig:clean" # For use with TwigBridge
execute :php, "artisan route:cache"
execute :php, "artisan config:cache"
end
end
end
end
(如果您不使用TwigBridge ,请确保删除twig twig:clean
行。)
进行了编辑,以包括clear-compiled
和view:clear
几行,因为这些似乎可以解决使用Capistrano部署Laravel应用程序时出现的其他问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.