nginx 健康检查配置

2023-11-11

nginx 配置

upstream test {
 server   127.0.0.1:8001 max_fails=2 fail_timeout=30s;
 server   127.0.0.1:8002 max_fails=2 fail_timeout=30s;
}
    server {
        listen   8888;
        location / {
                proxy_pass   http://test ;
                # 配置debug模式的错误信息,用于查看详细的报错信息,默认是没debug功能的
error_log /Users/opt/nginx/logs/error.log debug;
}
}

debug模式开始方式
在 nginx 解压包中运行该命令
./configure --prefix=/usr/local/nginx --with-debug --with-http_ssl_module

make & make install
说明:

  • –prefix=/usr/local/nginx 设置新编译的输出目录
  • –with-debug 开启debug功能

当需要配置https的时候也是这个流程,默认是没有SSL 那个模块的,也得 --with-XXX(具体模块名忘了)这样重新编译

alibaba/tengine 配置

 upstream cluster1 {  
        server 192.168.10.155:8440;
        server 192.168.10.155:8441;
       # server localhost:9090 max_fails=1 fail_timeout=40s;
       # server :9191 max_fails=1 fail_timeout=40s;
         check interval=3000 rise=2 fall=5 timeout=1000 type=http;
         check_keepalive_requests 100;
         check_http_send "GET /ca HTTP/1.0\r\n\r\n";
         check_http_expect_alive http_2xx http_3xx;
    }
server {
        listen 8999;
        location /{
            proxy_pass http://cluster1;
        }
        location /status {
             check_status;
            access_log   off;
           # allow SOME.IP.ADD.RESS;
            deny all;
        }
    }

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

nginx 健康检查配置 的相关文章

随机推荐