nginx 使用反向代理功能,代理本机后端IIS,很容易出现502,504错误.
时间: 2011-07-28来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
测试环境是在WINDOWS2003,IIS6,NGINX 1.0下. location ~/ { proxy_set_header Accept-Encoding "none"; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 120s; proxy_read_timeout 120s; proxy_send_timeout 120s; proxy_buffering off; proxy_pass http://127.0.0.1:8080; }
在测试的时候,如果直接访问,127.0.0.1:80,即访问nginx,就很容易出现错误:
upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream


上面这是NGINX的错误日志.在浏览器上反应就是502,504错误.


但如果在测试的时候,把测试地址改成http://127.0.0.1:8080,即访问IIS,根本不会出现超时什么的.


有人说是IIS脚本执行时间太长,但问题时,使用静态页面也出现同样的问题.就不应该是IIS的问题了.


后来又把同样的程序,放到另外一台2003上运行,把NGINX的代理地址也改了,情况就好多.
为什么直接代理本机却出现一大堆超时错误.不要说把timeout的值改大,那个改大了,浏览器上的反应就是一直在等待.还不如直接输出错误呢.


请问这种问题应该怎么解决呢?

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行