一.下载
wget https://tengine.taobao.org/download/tengine-3.0.0.tar.gz
二.解压
tar -zxvf tengine-3.0.0.tar.gz
三。编译安装
$ ./configure --add-module=modules/ngx_http_upstream_check_module
$ make
$ sudo make install
四。默认安装在
/usr/local/nginx/
修改conf/nginx.conf
upstream AAA{
server 172.16.10.226:50003;
server 172.16.10.226:50004;
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 18888;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#access_log "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G" main;
location /status
{
check_status;
#stub_status on;
access_log off;
}
location / {
proxy_pass http://AAA;
}
.....
}
五,注意
check的服务,必须根目录有get响应才行。如果服务路径http:server:port/app/test有响应检查会失败