tengine 配置集群、监控

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
#    load ngx_http_fastcgi_module.so;
#    load ngx_http_rewrite_module.so;
#}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    
    upstream local_tomcat {
        ip_hash;
                server 192.168.1.220:7001;
                server 192.168.1.220:7002;
            
                check interval=3000 rise=2 fall=5 timeout=1000 type=http;
                check_keepalive_requests 100;
                check_http_send "GET /arch HTTP/1.0\r\n\r\n";
                check_http_expect_alive http_2xx http_3xx;
        }

    server {
        listen       7000;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://local_tomcat;
        }
    
                location = /nginx_status {
                    stub_status on;
                    
                    allow 10.10.22.96;
                    deny all;
                }

                location /status {
                    check_status;
                    access_log   off;
            
                    allow 10.10.22.96;
                    deny all;
                }
    }  
}

 

posted on 2019-01-08 09:45  rigidwang  阅读(450)  评论(0编辑  收藏  举报