config目录多了一个plugin.php的配置文件,这个文件里的部分配置恰巧会影响的push文件中的端口号 导致websocket无法连接
我已经删除了该文件 慎用config/plugin.php的配置 最好不要去定义他
以前也做过了很多次了 今天新的项目死活连不上 用老项目现在也连不上 没辙了
希望大佬帮我看看是哪的问题
//app.php
[
'enable' => true,
'websocket' => 'websocket://0.0.0.0:3131',
'api' => 'http://0.0.0.0:3232',
'app_key' => 'xxxxx',
'app_secret' => 'xxxxxxx',
'channel_hook' => 'http://127.0.0.1:8787/plugin/webman/push/hook',
'auth' => '/plugin/webman/push/auth'
]
//process.php
[
'server' => [
'handler' => Server::class,
'listen' => config('plugin.webman.push.app.websocket'),
'count' => 1, // 必须是1
'reloadable' => false, // 执行reload不重启
'constructor' => [
'api_listen' => config('plugin.webman.push.app.api'),
'app_info' => [
config('plugin.webman.push.app.app_key') => [
'channel_hook' => config('plugin.webman.push.app.channel_hook'),
'app_secret' => config('plugin.webman.push.app.app_secret'),
],
]
]
]
]
//nginx
upstream webman {
server 127.0.0.1:8795;
keepalive 10240;
}
location ^~ / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Connection "";
if (!-f $request_filename){
proxy_pass http://webman;
}
}
location ~ "^/app/[a-zA-Z0-9_-]{16,32}$" {
proxy_pass http://127.0.0.1:3131;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
//连接代码
var webman_push = new Push({
url: 'ws://' + window.location.hostname,
app_key: 'bbaa660689dc6546f237056ac495af3e',
auth: '/plugin/webman/push/auth' // 订阅鉴权(仅限于私有频道)
});
push.js:245 WebSocket connection to 'ws://yingshi.com/app/bbaa660689dc6546f237056ac495af3e' failed:
这里写具体的系统环境相关信息
docker环境 外部开启了8795端口
location ~ "^/app/[a-zA-Z0-9_-]{16,32}$"
改成
location ^~ /app/bbaa660689dc6546f237056ac495af3e
试下不行哦
有没有是域名的问题,域名有没有做cdn?
本地的域名 端口做了代理
后台可以正常访问
直接用ip试试
不行哦 我真的没辙了 我的图贴纸下面了
这个webman push我之前用了4 5次了 ,这次硬是过不去