g87616758 发表于 2018-11-13 07:53:49

Tengine/nginx配置https/ssl/443端口健康检查

- interval:向后端发送的健康检查包的间隔。  
- fall(fall_count): 如果连续失败次数达到fall_count,服务器就被认为是down。
  
- rise(rise_count): 如果连续成功次数达到rise_count,服务器就被认为是up。
  
- timeout: 后端健康请求的超时时间。
  
- default_down: 设定初始时服务器的状态,如果是true,就说明默认是down的,如果是false,就是up的。默认值是true,也就是一开始服务器认为是不可用,要等健康检查包达到一定成功次数以后才会被认为是健康的。
  
- type:健康检查包的类型,现在支持以下多种类型
  
- tcp:简单的tcp连接,如果连接成功,就说明后端正常。
  
- ssl_hello:发送一个初始的SSL hello包并接受服务器的SSL hello包。
  
- http:发送HTTP请求,通过后端的回复包的状态来判断后端是否存活。
  
- mysql: 向mysql服务器连接,通过接收服务器的greeting包来判断后端是否存活。
  
- ajp:向后端发送AJP协议的Cping包,通过接收Cpong包来判断后端是否存活。
  
- : 指定后端服务器的检查端口。你可以指定不同于真实服务的后端服务器的端口,比如后端提供的是443端口的应用,你可以去检查80端口的状态来判断后端健康状况。默认是0,表示跟后端server提供真实服务的端口一样。
  

  

  

  
            upstream paygw {
  
                        server 10.1.1.1:80 weight=1 max_fails=1 fail_timeout=90s;
  
                        server 10.1.1.2:80 weight=1 max_fails=1 fail_timeout=90s;
  
                        check interval=3000 rise=3 fall=2 timeout=1000 type=http;
  
                        check_http_send "GET /lvs.html HTTP/1.0\r\n\r\n";
  
                        check_http_expect_alive http_2xx http_3xx;
  
                }
  
            upstream paygws {
  
                        server 10.1.1.1:443 weight=1 max_fails=1 fail_timeout=90s;
  
                        server 10.1.1.2:443 weight=1 max_fails=1 fail_timeout=90s;
  
                        check interval=3000 rise=3 fall=2 timeout=1000 type=http
  
                        check_http_send "GET /lvs.html HTTP/1.0\r\n\r\n";
  
                        check_http_expect_alive http_2xx http_3xx;
  
                }
  

  
#19e_pay gw
  
    server {
  
      listen       23000;
  
      server_nameUSBKEY_INIT;
  
      location / {
  
             indexindex.jhtml index.html index.htm index.php;
  
             proxy_pass       http://paygw;
  
             proxy_set_header   Host             $host:80;
  
             include      /app/nginx/conf/proxy.conf;
  
      }
  
   }
  
#19e_pay gwssl
  
   server {
  
         listen 23010 ssl;
  
         ssl_certificate   /app/nginx/conf/server.pem;
  
         ssl_certificate_key /app/nginx/conf/server.key;
  
         ssl_protocols      SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  
         ssl_ciphers HIGH:!aNULL:!MD5;
  
         server_name pngh.19e.cn;
  
         server_name_in_redirect off;
  
         error_page 502/errors/502.html;
  
         error_page 497 https://$host$uri?$args;
  

  
         location /errors {
  
          internal;
  
         }
  

  
      location / {
  
             indexindex.jhtml index.html index.htm index.php;
  
             proxy_pass       https://paygws;
  
            proxy_set_header   Host             $host:443;
  
             include      /app/nginx/conf/proxy.conf;
  
      }
  
    }


页: [1]
查看完整版本: Tengine/nginx配置https/ssl/443端口健康检查