https证书 websocket配置
1 通过阿里云申请https证书
2 免费证书
3 几分钟后审核通过,将证书部署到服务器上:
4 nginx配置
upstream wowcp{ server 127.0.0.1:9511; } upstream wscp{ server 127.0.0.1:9513; } server { listen 443; server_name wow.0571sd.com; ssl on; ssl_certificate cert/cert-1542189031524_wow.0571sd.com.crt; ssl_certificate_key cert/cert-1542189031524_wow.0571sd.com.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location /ws { #websocket配置 proxy_pass http://wscp; proxy_http_version 1.1; proxy_connect_timeout 4s; proxy_read_timeout 120s; proxy_send_timeout 10s; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } location / { proxy_pass http://wowcp; } }
5 重启nginx
6 客户端连接websocket地址如:
'wss://wow.0571sd.com/ws?ct=caipiao'
相关推荐
柳木木的IT 2020-11-04
joynet00 2020-09-23
wenf00 2020-09-14
蓝色深海 2020-08-16
wuychn 2020-08-16
取个好名字真难 2020-08-06
darylove 2020-06-26
shufen0 2020-06-20
Lovexinyang 2020-06-14
WangBowen 2020-06-14
firejq 2020-06-14
hjhmpl 2020-06-14
水痕 2020-06-07
guozewei0 2020-06-06
woniyu 2020-06-02
取个好名字真难 2020-06-01
guozewei0 2020-05-28
woniyu 2020-05-26