宝塔长连接开启方法 php think queue:listen --queue

执行命令
开启消息队列:
Supervisor管理器,运行

php think queue:listen --queue
开启长连接:

sudo -u www php think workerman start --d
开启定时任务:

php think timer start --d
删除下列函数
proc_open pcntl_signal pcntl_signal_dispatch pcntl_fork pcntl_wait pcntl_alarm

长连接是系统智慧客服功能和后台消息通知需要的
执行启动命令
sudo -u www php think workerman start --d
出现以下提示说明启动成功
在这里插入图片描述
location /notice {
proxy_pass http://127.0.0.1:20002/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /msg {
proxy_pass http://127.0.0.1:20003/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}

如果同一台服务器安装多个本系统,请修改常链接端口
第一步:程序需要修改:/config/workerman.php

'admin' => [
//协议
'protocol' => 'websocket',
//监听地址
'ip' => '0.0.0.0',
//监听后台消息端口
'port' => 20002,
//设置当前Worker实例启动多少个进程
'serverCount' => 1,
],
'chat' => [
//协议
'protocol' => 'websocket',
//监听地址
'ip' => '0.0.0.0',
//监听客服消息端口 开源版没内置客服系统可以不用修改
'port' => 20003,
//设置当前Worker实例启动多少个进程
'serverCount' => 1,
],

第二步:修改上面代理中的端口

proxy_pass http://127.0.0.1:20002/;  
//20002 后台消息通知端口改为和第一步修改代码中的端口一样

第三步:重启命令,进入程序跟目录执行

//1、进入程序跟目录,如果linux宝塔可以点击进入站点目录,
//上面菜单中有打开命令框,默认就进入到程序跟目录,
//如果ssh面板中使用一下命令进入程序跟目录 例如:
cd /www/wwwroot/crmeb
//2、一般情况这么执行就可以
php think workerman restart --d
//2、如果存在权限问题,请使用一下命令
sudo -u www php think workerman restart --d

5、重启长连接
出现以下提示说明之前已启动 需要重启
在这里插入图片描述
重启的话 使用这个命令
sudo -u www php think workerman restart --d

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

linlinlove2

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值