Tengine-2.2.3インストールと構成使用三

3371 ワード

コンフィギュレーション conf,バックエンドサーバのステータスチェック,およびステータスモニタリングを開きurlパス逆エージェントを制定する

#user  nobody;
worker_processes  1;
worker_rlimit_nofile 65535;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log  "pipe:rollback logs/error_log interval=1d baknum=7 maxsize=2G";
error_log  "pipe:rollback logs/error_log interval=60m baknum=5 maxsize=128M" info;

#pid        logs/nginx.pid;


events {
    worker_connections  20480;
}

# 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"';
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent -$request_body- "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"'
                      '"$upstream_cache_status" "$request_time" up:"$upstream_response_time"';

    #access_log  logs/access.log  main;
    #access_log  "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G"  main;
    access_log  "pipe:rollback logs/access_log interval=1h baknum=5 maxsize=512M"  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    include /usr/programs/tengine-2.2.3/conf/extra/*.conf;

    server_tokens on;
}

confフォルダの下にextraサブフォルダを作成し、各プロジェクトに個別のconfファイルを構成し、includeでロードします.
    upstream fsms_manage {
       	server 10.10.10.133:5000;
    	server 192.168.1.186:5000;
        #interval=milliseconds [fall=count] [rise=count] [timeout=milliseconds] [default_down=true|false] [type=tcp|http|ssl_hello|mysql|ajp] [port=check_port]
	    check interval=3000 rise=2 fall=5 timeout=1000 type=http;
        check_http_send "HEAD /fsms/sys/login HTTP/1.0\r
\r
"; check_http_expect_alive http_2xx http_3xx; } server { listen 8080; server_name www.fsms.com; #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 / { root /home/wntime/web-fs-admin; index index.html index.htm; } location /api/ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://fsms_manage/fsms/; } location /status { check_status; access_log on; allow 192.168.1.0/24; deny all; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }