VPS侦探论坛

 找回密码
 注册
查看: 2730|回复: 1

nginx 如何配置 wss协议啊

[复制链接]
发表于 2018-9-4 12:24:01 | 显示全部楼层 |阅读模式

nginx 如何配置 wss协议啊,已经开启了HTTPS协议
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2018-9-4 17:15:44 | 显示全部楼层


nginx 1.3+版本以上就支持websocket了,https虚拟主机配置中添加如下配置
  1.         location /wss
  2.         {
  3.             proxy_pass http://127.0.0.1:8282;
  4.             proxy_http_version 1.1;
  5.             proxy_set_header Upgrade $http_upgrade;
  6.             proxy_set_header Connection "Upgrade";
  7.             proxy_set_header X-Real-IP $remote_addr;
  8.         }
复制代码
里面后端websocket服务的127.0.0.1:8282自行调整
https://你域名/wss 进行调用
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-23 17:25 , Processed in 0.024608 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表