nginx配置websock请求,wss
nginx配置websock请求wss
server {listen 443 ssl;server_name 域名;ssl_certificate *.pem;ssl_certificate_key *.key;ssl_session_timeout 5m;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;ssl_prefer_server_ciphers on;location /wss/ {rewrite ^/wss/(.*)$ /$1 break;# 配置WebSocket代理 proxy_pass http://localhost:8899; # 后端WS服务器地址proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";proxy_read_timeout 3600s; # 延长超时时间}
}
websocket测试工具
https://toolwa.com/websocket/
wss://域名/wss/my-websocket