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;

}

}

相关推荐
码农101号3 小时前
Linux中shell编程表达式和数组讲解
linux·运维·服务器
powerfulzyh3 小时前
非Root用户启动SSH服务经验小结
运维·ssh
云道轩4 小时前
升级centos 7.9内核到 5.4.x
linux·运维·centos
爱学习的小道长4 小时前
Ubuntu Cursor升级成v1.0
linux·运维·ubuntu
EelBarb4 小时前
seafile:ubuntu搭建社区版seafile12.0
linux·运维·ubuntu
CryptoPP4 小时前
使用WebSocket实时获取印度股票数据源(无调用次数限制)实战
后端·python·websocket·网络协议·区块链
402 Payment Required4 小时前
serv00 ssh登录保活脚本-邮件通知版
运维·chrome·ssh
小柏ぁ4 小时前
calico/node is not ready: BIRD is not ready: BGP not established with xxx
运维·docker·kubernetes
Mintimate5 小时前
云服务器 Linux 手动 DD 安装第三方 Linux 发行版:原理与实战
linux·运维·服务器
RussellFans5 小时前
Linux 环境配置
linux·运维·服务器