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

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章