NGINX反向代理websocket并启用SSL(wss://)? [英] NGINX to reverse proxy websockets AND enable SSL (wss://)?

查看:519
本文介绍了NGINX反向代理websocket并启用SSL(wss://)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很迷茫,不愿独自构建NGINX,但我希望能够启用安全的websocket,而无需增加额外的层.

I'm so lost and new to building NGINX on my own but I want to be able to enable secure websockets without having an additional layer.

我不想在websocket服务器本身上启用SSL,但是我想使用NGINX在整个事情上添加一个SSL层.

I don't want to enable SSL on the websocket server itself but instead I want to use NGINX to add an SSL layer to the whole thing.

那里的每个网页都说我做不到,但是我知道我可以!感谢任何人(我自己)可以向我展示如何!

Every web page out there says I can't do it, but I know I can! Thanks to whoever (myself) can show me how!

推荐答案

仅需注意,nginx现在已在1.3.13版本上支持Websockets.使用示例:

Just to note that nginx has now support for Websockets on the release 1.3.13. Example of use:

location /websocket/ {

    proxy_pass ​http://backend_host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;

}

您还可以检查 nginx更改日志 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆