502vs504 - horoyoii/simple-load-balancer GitHub Wiki

502 Bad Gateway

1. ๋ฐœ์ƒ ์กฐ๊ฑด

  • upstream ์„œ๋ฒ„๊ฐ€ ๋ชจ๋‘ down ๋˜์–ด์žˆ์„ ๋•Œ - connection refused
2020/06/15 15:21:32 [error] 19845#19845: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: naver.com, request: "GET /ping HTTP/1.1", upstream: "http://127.0.0.1:8001/ping", host: "127.0.0.1:8081"

504 Gateway Time-out

  • ์‘๋‹ต์ด ์ œํ•œ์‹œ๊ฐ„ ๋‚ด๋กœ ์˜ค์ง€ ์•Š์„ ๋•Œ - Connection time out
    server {
        location / {        
            proxy_read_timeout 5s;            // proxy_read_timeout ์ด 5์ดˆ์ด๋ฉด, ์‘๋‹ต์ด 5์ดˆ ๋‚ด๋กœ ์•ˆ์˜ฌ ๋•Œ 504 ์—๋Ÿฌ
            proxy_connect_timeout 1s;
               
            proxy_pass http://wascluster;

        }
// + /var/log/nginx/error.log
2020/06/15 15:19:43 [error] 19845#19845: *13 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: naver.com, request: "GET /ping HTTP/1.1", upstream: "http://127.0.0.1:8001/ping", host: "127.0.0.1:8081"