相同伪静态规则,在宝塔nginx中部署了很多次都正常,换成咱们面板的openresty就报以下错误:
服务内部错误: stderr: 2025/01/15 22:33:29 [emerg] 21#21: unknown “connection_upgrade” variable nginx: [emerg] unknown “connection_upgrade” variable nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed
在 nginx.conf中增加以下片段,map那一段
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
…
##
# Connection header for WebSocket reverse proxy
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# further configurations …
}
感谢 已解决