使用nginx转发websocket,如果主项目使用https协议+域名访问,那么项目中的wss协议需要进行特殊配置,例如连接的websocket地址是wss://域名/项目名/abc
location /abc {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}