今天在测试大商创后台系统时,打开店铺结算,查看店铺对应的订单列表时,该列表自动跳转到502,查看线上和测试环境都能正常打开,唯独我的电脑上打开是502,
查询nginx的error.log日志,记录了如下错误
2019/11/26 10:38:55 [error] 328604#333604: *10 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: myshop.cn, request: "GET /admin/merchants_commission.php?act=commission_amount&seller=1,2,4,65,69,70,71,72,73,76,81,82,83,85,162&1574735928782782 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "myshop.cn", referrer: "http://myshop.cn/admin/merchants_commission.php?act=list" 2019/11/26 10:38:59 [error] 328604#333604: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: myshop.cn, request: "GET /admin/merchants_commission.php?act=commission_amount&type=all&cycle=-1&1574735928776776 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "myshop.cn", referrer: "http://myshop.cn/admin/merchants_commission.php?act=list" 2019/11/26 10:39:00 [error] 328604#333604: *15 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: myshop.cn, request: "GET /admin/merchants_commission.php?act=order_list&id=1 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "myshop.cn", referrer: "http://myshop.cn/admin/merchants_commission.php?act=edit&id=1" 2019/11/26 10:39:00 [error] 328604#333604: *15 CreateFile() "D:/phpstudy_pro/WWW/youhou/admin/error/502.html" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: myshop.cn, request: "GET /admin/error/502.html HTTP/1.1", host: "myshop.cn", referrer: "http://myshop.cn/admin/merchants_commission.php?act=edit&id=1" 2019/11/26 10:39:00 [error] 328604#333604: *15 CreateFile() "D:/phpstudy_pro/WWW/youhou/error/404.html" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: myshop.cn, request: "GET /admin/error/502.html HTTP/1.1", host: "myshop.cn", referrer: "http://myshop.cn/admin/merchants_commission.php?act=edit&id=1"
百度了一下,找到了解决方法,再此记录一下
在 nginx.conf 的http段,加入下面的配置:
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
重启后一般就可以解决, 如果还是报502,再在host配置的php段加入下面配置:
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
重启nginx即可。
参考:https://www.jianshu.com/p/389f45d0e7a2