网站配置SSL证书后websocket连接问题

网站配置SSL证书后,网址访问使用https://访问,使用原来的websocket连接ws://ip+port/websocket不能访问。

修改为wss://域名/websocket

在nginx.conf中配置

在server中加配置,然后重启nginx服务

server {
		listen 443 ssl;
		server_name ***; 
		...
		location / {
			...
		}
//添加以下配置 location /websocket { proxy_pass http://{ip}:{port}; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }

  参考链接:https://blog.csdn.net/hfismyangel/article/details/82758629

                         https://blog.csdn.net/nw_ningwang/article/details/88946991

原文地址:https://www.cnblogs.com/webttt/p/14234007.html