千家信息网

websocket中怎么配置https 连接

发表于:2025-02-03 作者:千家信息网编辑
千家信息网最后更新 2025年02月03日,本篇文章为大家展示了websocket中怎么配置https 连接,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。websocket 地址'wss://hongo
千家信息网最后更新 2025年02月03日websocket中怎么配置https 连接

本篇文章为大家展示了websocket中怎么配置https 连接,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

websocket 地址

'wss://hongonew.com/hone/web/websocket/';

nginx 配置

server {        listen       443 ssl;        server_name  hongonew.com;                                        ssl on;        ssl_certificate      **;        ssl_certificate_key  **;        ssl_session_cache    shared:SSL:1m;        ssl_session_timeout  5m;        ssl_ciphers  HIGH:!aNULL:!MD5;        ssl_prefer_server_ciphers  on;                                                  location ~/hone/{              proxy_pass http://127.0.0.1:8080;              index  dashboard index;               #websocket额外配置开始                          proxy_http_version 1.1;                          proxy_set_header Upgrade $http_upgrade;                          proxy_set_header Connection "upgrade";                          proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源                  proxy_read_timeout 500s;#读超时时间                  proxy_send_timeout 500s;#写超时时间              #websocket额外配置结束              proxy_set_header Host       $http_host;              proxy_set_header X-Real-IP $remote_addr;              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;               proxy_set_header X-Forwarded-Proto $scheme;            }                                                       access_log  logs/https_access.log;                error_log  logs/https_error.log;    }

上述内容就是websocket中怎么配置https 连接,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。

0