作者:waxw | 来源:互联网 | 2023-09-15 01:43
1.直接上nginx配置文件注意:后端端口使用wss:proxy_passhttps:wss_8;后端端口使用ws:proxy_passhttp:wss_8;upstreamwss
1.直接上nginx配置文件
注意:
后端端口使用wss:proxy_pass https://wss_8;
后端端口使用ws :proxy_pass http://wss_8;
upstream wss_8{
server 127.0.0.1:8004;
}
###
server {
listen 8104 ssl;
server_name bbxx.ios.xxx.com;
#ssl on;
ssl_certificate ssl/xxx.com.crt;
ssl_certificate_key ssl/xxx.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
access_log /var/log/nginx/wss_8_forward_port_8104.access.log;
error_log /var/log/nginx/wss_8_forward_port_8104.error.log;
location / {
add_header Access-Control-Allow-Origin *;
proxy_redirect off;
proxy_pass https://wss_8;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
error_page 500 502 503 504 /50x.html;
}
2.在线websocket接口测试工具:https://www.qvdv.com/tools/qvdv-websocket.html