内容简介:组态:> Nginx作为反向代理SSL协商> Apache Tomcat.
组态:
> Nginx作为反向代理SSL协商
> Apache Tomcat.
除了文件上传外,一切似乎都运行正常.由于某种原因文件上传永远不会完成通过下面列出的配置,我可以上传小文件(4K). 194K文件上传失败.当我将“client_body_buffer_size”增加到256K时,我可以上传194K文件,但500K文件上传失败.将“client_body_buffer_size”增加到256K以上没有任何影响.
注意:当我直接访问Tomcat并上传500K文件时,它会在几毫秒内完成.
所以,看起来Nginx配置有问题.任何建议都非常感谢.
upstream tomcat_server { server 127.0.0.1:9090 fail_timeout=0; keepalive 16; } location / { root /xyz; proxy_http_version 1.1; proxy_pass http://tomcat_server; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_buffering on; proxy_connect_timeout 75; proxy_send_timeout 180; proxy_read_timeout 1200; keepalive_timeout 120; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_temp_path /tmp/nginx/proxy; proxy_temp_file_write_size 1000m; }
我已经尝试将其他几个参数添加到nginx配置(client_body_temp_path,proxy_temp_path,proxy_temp_file_write_size).他们似乎没有帮助.
====
更新 – 2013/07/30:
进一步调查显示我们上传196K文件有问题. 194K文件有效. “client_body_buffer_size”值设置为256K.
如果出现故障,Nginx调试日志会显示以下内容:
2013/07/30 16:29:57 [debug] 14208#0: *1 recv: fd:11 2606 of 16384 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy status 200 "200 OK" 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Server: Apache-Coyote/1.1" 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Content-Type: text/html;charset=utf-8" 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Date: Tue, 30 Jul 2013 22:29:57 GMT" 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Connection: close" 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header done 2013/07/30 16:29:57 [debug] 14208#0: *1 xslt filter header 2013/07/30 16:29:57 [debug] 14208#0: *1 HTTP/1.1 200 OK^M Server: nginx/1.5.2^M Date: Tue, 30 Jul 2013 22:29:57 GMT^M Content-Type: text/html;charset=utf-8^M Transfer-Encoding: chunked^M Connection: keep-alive^M 2013/07/30 16:29:57 [debug] 14208#0: *1 write new buf t:1 f:0 000000001E61DAD8, pos 000000001E61DAD8, size: 168 file: 0, size: 0 2013/07/30 16:29:57 [debug] 14208#0: *1 http write filter: l:0 f:0 s:168 2013/07/30 16:29:57 [debug] 14208#0: *1 http cacheable: 0 2013/07/30 16:29:57 [debug] 14208#0: *1 posix_memalign: 000000001E62D450:4096 @16 2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy filter init s:200 h:0 c:0 l:-1 2013/07/30 16:29:57 [debug] 14208#0: *1 http upstream process upstream 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe read upstream: 1 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe preread: 2465 2013/07/30 16:29:57 [debug] 14208#0: *1 readv: 1:13778 2013/07/30 16:29:57 [debug] 14208#0: *1 readv() not ready (11: Resource temporarily unavailable) 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe recv chain: -2 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe buf free s:0 t:1 f:0 000000001E61DBD0, pos 000000001E61DC5D, size: 2465 file: 0, size: 0 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe length: -1 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe write downstream: 1 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe write busy: 0 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe write: out:0000000000000000, f:0 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe read upstream: 0 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe buf free s:0 t:1 f:0 000000001E61DBD0, pos 000000001E61DC5D, size: 2465 file: 0, size: 0 2013/07/30 16:29:57 [debug] 14208#0: *1 pipe length: -1 2013/07/30 16:29:57 [debug] 14208#0: *1 event timer add: 11: 180000:1375223577332 2013/07/30 16:29:57 [debug] 14208#0: *1 http upstream request: "/upload/html?" 2013/07/30 16:29:57 [debug] 14208#0: *1 http upstream send request handler 2013/07/30 16:29:57 [debug] 14208#0: timer delta: 6 2013/07/30 16:29:57 [debug] 14208#0: posted events 0000000000000000 2013/07/30 16:29:57 [debug] 14208#0: worker cycle 2013/07/30 16:29:57 [debug] 14208#0: epoll timer: 179994
我在上面的日志片段中注意到“http上游发送请求处理程序”,在成功的情况下,我看到:
2013/07/30 16:29:44 [debug] 14208#0: *1 http upstream dummy handler
知道“http上游发送请求处理程序”和“http上游虚拟处理程序”是什么意思,它们意味着什么?
以上所述就是小编给大家介绍的《无法使用Nginx(反向代理SSL协商)和Tomcat上传大文件》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 强制缓存(200)和协商缓存(304)
- 轻松学会HTTP缓存(强缓存,协商缓存)
- HTTP缓存 - 强缓存/协商缓存/浏览器刷新
- 【技术分享】OpenSSL握手重协商过程中存在漏洞可导致拒绝服务
- 一次JDBC与MySQL因“CST”时区协商误解导致时间差了13或14个小时
- Windows 10 解决无法完整下载安装语言包(日语输入法无法下载使用)
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Apache Modules Book
Nick Kew / Prentice Hall PTR / 2007-02-05 / USD 54.99
"Do you learn best by example and experimentation? This book is ideal. Have your favorite editor and compiler ready-you'll encounter example code you'll want to try right away. You've picked the right......一起来看看 《The Apache Modules Book》 这本书的介绍吧!