nginx 健康检查配置

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;
        }
    }

你可能感兴趣的:(java)