windows下nginx配置后,http访问pending怎么回事?

conf配置如下
security_ui 下是静态页面,访问没问题
http://safeguard 对应的是后台程序
譬如访问 http://localhost:8090/api/index?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null
访问的时候时不时pending,有时很快,有时很久才得到响应
怎么回事?
ps:不用8090端口进行nginx路由,直接用8080就没问题

upstream safeguard{
   server localhost:8080;
   #server 192.168.194.72:8013;
   #ip_hash;
}

server {
    listen       8090;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        proxy_pass http://safeguard;
        index  index.html index.htm;
    }


    location /security_ui {
        root   D:\svn\safeGuard;
        index  index.html index.htm;
    }
    。。。
    

nginx log日志:

2018/03/27 19:25:04 [error] 11868#9296: *192 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, client: 127.0.0.1, server: localhost, request: "GET /api/index/pIndex?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null HTTP/1.1", upstream: "http://[::1]:8080/api/index/pIndex?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null", host: "localhost:8090", referrer: "http://localhost:8090/security_ui/html/index.html?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null"
2018/03/28 10:48:02 [error] 4092#212: *7 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, client: 127.0.0.1, server: localhost, request: "GET /api/index/pIndex?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null HTTP/1.1", upstream: "http://[::1]:8080/api/index/pIndex?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null", host: "localhost:8090", referrer: "http://localhost:8090/security_ui/html/index.html?msisdn=bc65670205bff064f878d61afa2e98b5&channel=null"
阅读 11.3k
3 个回答

感觉与nginx配置关系不大。检查一下后台代码。

遇到类似的问题,不走ningx直接访问都是100ms左右,走nginx有时候直接达到proxy_connect_timeout默认设置的60s之后才返回。
图片描述
图片描述
找不到原因,临时解决办法是把超时时间设置为3s。

proxy_connect_timeout 3s;

pengding状态是说后端接口还没响应,在等待,这个不应该是前端的锅

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题