公司的电子商务网站,前端使用Nginx作反向代理,后端服务器使用的是LAMP架构,网站可以正常访问但在后台管理中无法上传文件和图片,注册用户提交数据时报错:502 Bad Gateway Nginx,而在后台上传图片时Nginx错误日志则有如下报错:
upstream prematurely closed connection while reading response header from upstream, client: 19.13.226.1, server: www.nt.cn, request: "POST /index.php?controller=pic&action=upload_json&dir=image HTTP/1.1", upstream: " http://192.168.1.10:80/index.php?controller=pic&action=upload_json&dir=image ", host: "www.nt.cn", referrer: " http://www.nt.cn/index.php?controller=seller&action=goods_edit&id=506 "
解决:
upstream prematurely closed connection while reading response header from upstream, client: 19.13.226.1, server: www.nt.cn, request: "POST /index.php?controller=pic&action=upload_json&dir=image HTTP/1.1", upstream: " http://192.168.1.10:80/index.php?controller=pic&action=upload_json&dir=image ", host: "www.nt.cn", referrer: " http://www.nt.cn/index.php?controller=seller&action=goods_edit&id=506 "
解决:
1) 在DNS解析记录中增加CNAME解析,可以解决问题,这也是我目前解决的办法,只是需要一个动态域名;
本文转自 zengwj1949 51CTO博客,原文链接:http://blog.51cto.com/zengwj1949/2044005