问题描述
我想在我的项目中使用Laravel队列系统,并且想在服务器的后台永久运行 php artisan queue:work ,我对此进行了一些搜索,然后找到了可以运行的命令行即使从ssh终端退出后,它也可能会关闭,但在某些情况下可能会给我带来严重的问题.因此,过了一会儿,我发现有一个名为Supervisord的软件包,即使重新启动服务器,该软件包也可以重新启动命令.因此,我想请某人从0到100逐步提供帮助,如何在Super 7上安装Supervisord并对其进行配置,然后设置队列命令行.太谢谢你了..
I want to use Laravel queue system in my project and I want to run php artisan queue:work permanently on server's background, I did some searches about this and I found a command line which can run it even after quit from ssh terminal but It can be down in some cases and can make terrible problems for me. So after a while I found out that there is a package named Supervisord which can restart command even after server is rebooted. So I want to ask someone to help from 0 to 100 step by step how to install Supervisord and configure it on centos 7 and after that set the queue command line. Thank you so much..
推荐答案
以下是如何在centos 7上安装和配置supervisor来永久运行Laravel队列:
here is how to install and config supervisord on centos 7 to run Laravel queues permanently:
-
easy_install supervisor
-
yum install supervisor
-
vim /etc/supervisord.conf
如下编辑节程序:
easy_install supervisor
yum install supervisor
vim /etc/supervisord.conf
edit section program as following:
[program:laravel-worker]
command=php /path/to/app.com/artisan queue:work
process_name=%(program_name)s_%(process_num)02d
numprocs=8
priority=999
autostart=true
autorestart=true
startsecs=1
startretries=3
user=apache
redirect_stderr=true
stdout_logfile=/path/to/log/worker.log
-
systemctl enable supervisord
在启动时自动运行 -
systemctl restart supervisord
重新启动服务
systemctl enable supervisord
to autorun at startsystemctl restart supervisord
to restart the service
这篇关于在centos 7上安装和配置超级用户以永久运行Laravel队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!