关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

宝塔面板API迁移数据出现错误 :nginx: unknown “connection_upgrade”

发布时间:2024-02-16 13:41:17

宝塔api迁移插件的时候,迁移数据的时候突然出现错误 :nginx: unknown “connection_upgrade”,这是什么问题呢?

配置 “$connection_upgrade” 变量

image.png

连接升级通常与 WebSockets 结合使用。 在 nginx 中,我们可以根据 $http_upgrade 变量将 HTTP 连接升级为 WebSocket 连接。nginx配置文件出了问题,将下面map代码块补上即可。

我们可以使用map块在nginx中定义连接和http升级之间的依赖关系:

vim nginx.conf

map $http_upgrade $connection_upgrade {

default upgrade;

” close;

如果 Upgrade 标头设置为 ‘’,此 map 块告诉 nginx 正确设置相关的 Connection 标头来关闭连接。 将 map 块放入 nginx 配置的 http 块中。 nginx 配置的默认文件路径是 /etc/nginx/nginx.conf 。





/template/Home/Zkeys/PC/Static