no live upstreams while connecting to upstream

nginx异常

访问nginx时,出现error,查看日志如下:

2018/11/21 20:19:44 [error] 1652#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.254.1, server: 192.168.254.134, request: "GET / HTTP/1.1", upstream: "http://192.168.254.137:80/", host: "192.168.254.134"
2018/11/21 20:19:44 [error] 1652#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.254.1, server: 192.168.254.134, request: "GET / HTTP/1.1", upstream: "http://192.168.254.130:80/", host: "192.168.254.134"
2018/11/21 20:19:45 [error] 1652#0: *1 no live upstreams while connecting to upstream, client: 192.168.254.1, server: 192.168.254.134, request: "GET /favicon.ico HTTP/1.1", upstream: "http://backend/favicon.ico", host: "192.168.254.134", referrer: "http://192.168.254.134/"

可以看到一条:no alive upstream…;查看官方文档,发现问题出自upstream模块的配置

正确的写法:

  #server ip:port max_fails=m faile_timeout=ns;
   upstream backend
    {
    server 192.168.254.137:8080 max_fails=5 fail_timeout=60s;
    server 192.168.254.130:8080 max_fails=5 fail_timeout=60s;
    }

你可能感兴趣的:(Linux,Nginx)