宝塔 websocket连接wss配置

发布时间 2023-09-22 02:26:16作者: 成文的博客
https要使用wss连接,wss://xxxxx.com/wss 就转发到了 服务器内的127.0.0.1:2346服务。
具体转发可以放在 文件配置或者 伪静态里面
建议放在伪静态里面容易管理
nginx配置
location / {
  if (!-e $request_filename) {
      rewrite  ^/(.*)$  /index.php/$1  last;
      break;
  }
}
location /wss {
	proxy_pass http://127.0.0.1:2346;
	proxy_read_timeout 400s;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "Upgrade";
	proxy_set_header X-Real-IP $remote_addr;
}