Nginx [error] 34948#38560: *6 upstream sent invalid chunked response while reading response

[error] 34948#38560: *6 upstream sent invalid chunked response while reading response header from upstream

报错特征

1.logs/error.log: upstream sent invalid chunked response while reading response header from upstream
2.浏览器访问控制台提示错误:Failed to load resource: net::ERR_EMPTY_RESPONSE
3.Postman 测试报错:Could not get response Error: socket hang up
4.get、post请求都有响应,但put方法访问报以上1、2、3类型错误

1.杀掉所有Nginx进程

# Windows
taskkill /f /im nginx.exe
# Linux
ps -ef |grep nginx|awk '{print "kill -9" $2}' | sh

2.Nginx conf 修改

server {
        listen       8181;
        server_name  localhost;
        
        #charset koi8-r;

        root D:\dist;

        # 代理系统接口
        location /  {
            try_files $uri $uri/ /index.html;
        }

        # 网关
        location /web {
            proxy_pass http://127.0.0.1:8080;
            # 重点!!!添加这两条。如果已经添加过或者重启了很多次还是不行。请再次确认一下
            # 是否杀掉了所有Nginx进程,保证确实是重启了。因为我在重启了很多次不生效,
            # 最终杀掉进程重启解决了问题。
            # 如果以上确实操作后还不行,那可能在此基础上还需检查proxy_temp 是否拥有权限
            # 或者还存在其他问题。
            proxy_http_version 1.1;
            proxy_set_header Connection "";
        }
   }

proxy_http_version 1.1;
proxy_set_header Connection "";

3.重新启动Nginx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值