Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx uptream health check

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Upstream hello {

Server 100.14.1.3:1201

Server 100.14.1.4:1201

Check interval=3000 rise=2 fall=5 timeout=1000 type=http

Check_http_send "HEAD / product HTTP/1.0\ r\ n\ r\ n"

Check_http_expect_alive http_2xx http_3xx

}

Server {

Listen 80

Server_name hello.youbest.com

Access_log / data/logs/nginx/hello.youbest.com.access.log main

Location / {

Proxy_set_header X-Forwarded-For $remote_addr

Proxy_set_header X-Real-IP $remote_addr

Proxy_pass http://hello;

}

}

First, confirm whether the service type is http or tcp.

Check interval=3000 rise=2 fall=5 timeout=1000 type=http; or check interval=3000 rise=2 fall=5 timeout=1000 type=tcp; then confirms whether the url of the health check supports HEAD requests or GET requests [root@100-14-1-3] # curl-v-XHEAD http://hello.youbest.com/productAbout to connect () to hello.youbest.com port 80 (# 0) Trying 10.24.1.3. ConnectedConnected to hello.youbest.com (100.14.1.3) port 80 (# 0)

HEAD / HTTP/1.1

User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh3/1.4.2

Host: baidu.com

Accept: /

< HTTP/1.1 200 OK

< Date: Tue, 07 Jan 2020 08:29:28 GMT

< Server: Apache

< Last-Modified: Tue, 12 Jan 2010 13:48:00 GMT

< ETag: "51-47cf7e6ee8400"

< Accept-Ranges: bytes

< Content-Length: 81

< Cache-Control: max-age=86400

< Expires: Wed, 08 Jan 2020 08:29:28 GMT

< Connection: Keep-Alive

< Content-Type: text/html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report