http 的时候
this.socket = new WebSocket('ws://localhost:8080/websocket/1');
https 时候
this.socket = new WebSocket('wss://www.域名.cn/wss/1');
//进入你的nginx里面
cd /usr/local/nginx/conf
//修改配置文件里的
server vim nginx.conf
注意 我这里是ws://localhost:8080/websocket/1
8080 后面还跟了一个/websocket
所以 是location /wss/ {
如果你没有/websocket
一个有/
一个没有/
那就是location /wss{
location /wss/ {
proxy_pass http://localhost:8080/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}