🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### workermen报错与解决 #### 1、报错 net::ERR_INVALID_HTTP_RESPONSE ``` WebSocket connection to 'ws://xxx.com:xx/' failed: Error during WebSocket handshake: Unexpected response code: xxx WebSocket connection to 'ws://xxx.com:xx/' failed: Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE ``` 端口没开放 检查`Apache`或者`Nginx`配置的域名,中是否有`workerman`的端口,,如果没有,则开启端口 在相应网站的server里面多添加一个配置: ``` location /wss { proxy_pass http://127.0.0.1:你的worker端口; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Real-IP $remote_addr; } ``` #### 2、报错 404 问题1:failed: Error during WebSocket handshake: Unexpected response code: 404 我这里的原因是服务器的端口没有打开。 ``` Error during WebSocket handshake: Unexpected response code: 404 (anonymous) @ ceshi.php:26 ``` 1、开放端口 ``` firewall-cmd --zone=public --add-port=5672/tcp --permanent # 开放5672端口 firewall-cmd --zone=public --remove-port=5672/tcp --permanent #关闭5672端口 firewall-cmd --reload # 配置立即生效 ``` 2、查看防火墙所有开放的端口 ``` firewall-cmd --zone=public --list-ports ``