Centos安装Supervisor3.3.0搭配Laravel队列

安装步骤

1.安装pip

sudo yum -y install epel-release

sudo yum -y install python-pip

*这种方式安装的supervisor不支持python3,所以不要升级pip

2.安装supervisor(高版本会报错)

pip install supervisor==3.3.0

3.生成配置文件

echo_supervisord_conf > /etc/supervisord.conf

4.修改配置文件(laravel队列)

vi /etc/supervisord.conf

引入自定义配置文件 

[include]

files = /etc/supervisord.conf.d/*.conf

*include前的分号一定要去掉

配置文件内容:

[program:xxx]

autorestart=true

directory=/vagrant_data/laravel

command=php artisan queue:work --daemon --env=local

process_name=%(process_num)s

numprocs=1

stdout_logfile=/var/log/queue/laravel.log

stderr_logfile=/var/log/queue/error.laravel.log

5.配置Web访问

[inet_http_server]    

port=127.0.0.1:9010  

*inet_http_server前的分号一定要去掉

Nginx配置

server {

    listen      80;

    server_name sup.xxx.local;

    access_log  /var/log/nginx/sup.access.log main;

    error_log  /var/log/nginx/sup.error.log;

    location / {

        proxy_pass http://127.0.0.1:9010;

        proxy_set_header  Host $host;

    }

}

supervisor的常用命令

启动

supervisord -c /etc/supervisord.conf

查看状态

supervisorctl status

重新加载supervisor(当修改supervisord.conf使用)

supervisorctl reload

常见问题:

1.Unlinking stale socket /tmp/supervisor.sock
解决:

sudo unlink /tmp/supervisor.sock

你可能感兴趣的:(supervisor,laravel,php)