nginx 导致websocket无法连接的解决办法

答:在config配置文件中

map http_upgrade connection_upgrade {

default upgrade;

'' close;

}

server {

listen 443 ssl;

server_name your_domain.com;

ssl_certificate /path/to/ssl_certificate.crt;

ssl_certificate_key /path/to/ssl_certificate.key;

location / {

proxy_pass http://localhost:8082; # WebSocket应用的地址

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection $connection_upgrade;

}

}

相关推荐
AC赳赳老秦38 分钟前
财务报销自动化:用 OpenClaw 自动识别发票信息、填写报销单、校验报销规则,减少手工操作
运维·网络·eclipse·github·visual studio·deepseek·openclaw
倔强的石头1062 小时前
【Linux 指南】文件系统系列(一):磁盘底层原理 —— 从物理结构到 CHS与LBA 寻址全解析
linux·运维·服务器
陶然同学3 小时前
【Linux及Shell】VMware&Ubuntu&Xshell安装
linux·运维·xshell8·xftp8
小乐笙3 小时前
笔记:纯真 IP 库使用
运维·网络·tcp/ip
咖喱o3 小时前
DHCP
linux·运维·服务器·网络
IMPYLH4 小时前
Linux 的 touch 命令
linux·运维·服务器·bash
uestcwhc4 小时前
服务器定时发送邮件设置
运维·服务器
雷工笔记4 小时前
MES 系统设备管理模块详细设计方案
大数据·运维·网络
wangchunting4 小时前
VMware17 使用Rocky Linux 9.7系统
linux·运维·服务器
我不是立达刘宁宇5 小时前
基础文件操作
运维