域名为dx.com
在阿里云主机里 gatewayworker 开启websocket://0.0.0.0:8282 成功
lsof -i:8282 有被listen
但以下浏览器里的
所以目前总结
因为是云主机ECS,所以不晓得应该如何指定ip问题,所以特来请教应该如何设定
$gateway0 = new Gateway("Websocket://0.0.0.0:8282");// 正式 gateway 进程
$gateway0->name = 'GatewayWs';// 设置名称,方便status时查看
$gateway0->count = 1;// 设置进程数,gateway进程数建议与cpu核数相同
$gateway0->lanIp = '127.0.0.1';// 正式分布式部署时请设置成内网ip(非192.168.10.149)
$gateway0->startPort = 3000;// 内部通讯起始端口,假如$gateway->count=4,起始端口为4000
$gateway0->registerAddress = '127.0.0.1:1238';// 正式服务注册地址
$gateway0->pingInterval = 60;// 心跳间隔
$gateway0->pingData = '{"type":"ping"}';// 心跳数据
------------------------------------------------ WORKERMAN -------------------------------
Workerman version:4.0.3 PHP version:7.4.12
------------------------------------------------- WORKERS --------------------------------
proto user worker listen processes status
tcp root AppBusinessWorker none 1 [OK]
tcp root GatewayWs websocket://0.0.0.0:8282 1 [OK]
tcp root Register text://127.0.0.1:1238 1 [OK]
------------------------------------------------------------------------------------------
HTML
WebSocket connection to 'ws://127.0.0.1:9602/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Aliyun ECS Centos 7 nginx gatewayworker
防火墙开放特定端口,在浏览器连接你的服务器IP或者域名,不是0.0.0.0/127.0.0.1/localhost这些玩意
端口开了
换成域名后,出了这样
failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
https://www.workerman.net/doc/workerman/faq/client-connect-fail.html
按照手册一项一项排查,一般是安全组没开8282端口,如果有安装宝塔宝塔也要开8282端口
连接地址一般是 ws://域名.com:8282