解决nginx到后端服务器Connection: close问题
2017-07-05 15:06
537 查看
以下是官方原文:
By default, NGINX redefines two header fields in proxied requests, “Host” and “Connection”, and eliminates the header fields whose values are empty strings. “Host” is set to the
而且 其中一个配置:
所以其实 nginx 到后端 例如 tomcat 之间的连接是 http1.0的协议
所以解决 方法很简单:
By default, NGINX redefines two header fields in proxied requests, “Host” and “Connection”, and eliminates the header fields whose values are empty strings. “Host” is set to the
$proxy_hostvariable, and “Connection” is set to
close.
而且 其中一个配置:
Syntax: proxy_http_version 1.0 | 1.1; Default: proxy_http_version 1.0; Context: http, server, location This directive appeared in version 1.1.4.
所以其实 nginx 到后端 例如 tomcat 之间的连接是 http1.0的协议
所以解决 方法很简单:
upstream http_backend { server 127.0.0.1:8080; } server { ... location /http/ { proxy_pass http://http_backend; proxy_http_version 1.1; proxy_set_header Connection ""; ... } }
相关文章推荐
- android客户端通过Get方式提交参数给服务器,使用URL和HttpURLConnection实现,以及乱码问题解决
- 解决nginx服务器访问不存在的php页面显示No input file specified.问题
- nginx、Apache、IIS服务器解决 413 Request Entity Too Large问题方法汇总
- 使用Apache 的 FTP Client获取FTP服务器上的文件列表FTP response 421 received.Server closed connection问题的解决
- [置顶] Bmob解决了后端逻辑重复开发和维护的问题 无需后端编程和租用服务器 让移动开发更简单
- Nginx造成后端服务器大量TIME_WAIT的解决办法
- Cannot close connection,finalizing with closed connection问题解决。
- android客户端通过Get方式提交参数给服务器,使用URL和HttpURLConnection实现,以及乱码问题解决
- 配置解决Nginx服务器中WordPress路径不自动加斜杠问题
- tomcat服务器下使用nginx实现最简单的动静分离--解决css、js不加载的问题
- 解决nginx服务器图片(js/背景图片)不能显示问题
- 使用Apache 的 FTP Client获取FTP服务器上的文件列表FTP response 421 received.Server closed connection问题的解决
- 通过Nginx访问后端应用,ERR_CONTENT_LENGTH_MISMATCH 问题的解决
- nginx作为代理 后端服务器ip问题
- centos系统,基于nginx服务器,用https访问php页面总弹出下载页面问题完美解决
- nginx图片服务器优化 解决流量和存储问题
- nginx做前端,后端web服务器无法获取真正客户机的ip,解决方法
- nginx后端服务器返回给nginx502、504、404、执行超时等错误状态的解决方法
- nginx配置反向代理解决前后端分离跨域问题
- 前后端分离:利用nginx的rewrite解决跨域问题