前言
wss协议实际就是websocket+ssl,就是在websocket协议上加入ssl层,类似https(http+ssl)。
Nginx websocket代理主要配置:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
ws配置示例
server {
listen 80;
server_name yourdomain.com;
location /websocket {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}