https ssl 使用wss 无法通信的解决方案

nginx顶部配置
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}
upstream websocket {
    server 你的ip地址:你的端口;  #这里可以是多个服务端IP(分多行),设置权重就可以实现负载均衡了
}
#SSL-END 下边配置    
    #SSL-END
    #wss协议转发 前端里面要访问的链接
    # 访问:wss://xxxx.com/app
    location /app {
        proxy_pass http://你的域名:你的ws端口号;#代理到上面的地址去,
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }

猜你喜欢

转载自blog.csdn.net/Sncdma/article/details/108211207