关闭ssh后Laravel Horizo​​n停止 [英] Laravel Horizon stops after I close ssh

查看:77
本文介绍了关闭ssh后Laravel Horizo​​n停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用Laravel和Horizo​​n,所以很抱歉我的问题在那里.

I am just getting started with Laravel and Horizon so I am sorry if my question is a bit out there.

我已经使用Horizo​​n和Redis数据库设置了Laravel.只要我在其中运行 php artisan horizo​​n 命令的情况下打开SSH连接,一切都可以正常工作.一旦我关闭SSH会话,它就会停止工作.

I have setup Laravel with Horizon and a Redis database. Everything works fine as long as I have my SSH connection open with the php artisan horizon command running in there. As soon as I close the SSH session, it stops working.

我对这些事情不熟悉,所以我想知道会有什么解决方案.我发现有人说你应该做 php artisan horizo​​n& ,但这似乎可以工作几分钟,然后什么也没有.

I am new with these things so I am wondering what solution there would be. I found someone saying you should do php artisan horizon & but that seems to work for a few minutes and then nothing.

该系统是在Web服务器上设置的,因此也许cronjob可以修复它.但是我对这些事情的经验非常有限.我希望外面有人可以提供帮助.

The system is as setup on a webserver so maybe a cronjob can fix it. But my experience with those things is very limited. I hope someone out there can assist.

推荐答案

https://laravel.com/docs/5.7/horizo​​n#deploying-horizo​​n

如果要将Horizo​​n部署到活动服务器,则应配置一个进程监视器以​​监视 php artisan horizo​​n 命令,并在意外退出时重新启动它.在将新代码部署到服务器时,您需要指示Horizo​​n主进程终止,以便可以由进程监视器重新启动它并接收代码更改.

If you are deploying Horizon to a live server, you should configure a process monitor to monitor the php artisan horizon command and restart it if it quits unexpectedly. When deploying fresh code to your server, you will need to instruct the master Horizon process to terminate so it can be restarted by your process monitor and receive your code changes.

Laravel为此建议主管:

Laravel recommends Supervisor for this:

[program:horizon]
process_name=%(program_name)s
command=php /home/forge/app.com/artisan horizon
autostart=true
autorestart=true
user=forge
redirect_stderr=true
stdout_logfile=/home/forge/app.com/horizon.log

这篇关于关闭ssh后Laravel Horizo​​n停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆