Blame view

monitor-service-common/src/main/resources/template/aws-nginx.hbs 3.88 KB
zhouxiang authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
user  www www;

worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;

pid logs/nginx.pid;
# [ debug | info | notice | warn | error | crit ]
#error_log  /Data/logs/nginx/nginx_error.log info;
error_log  /Data/logs/nginx/nginx_error.log info;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
{
       use epoll;

       #maxclient = worker_processes * worker_connections / cpu_number
       worker_connections 51200;
}

http
{
       include      mime.types;
       default_type  application/octet-stream;
       #charset  gb2312,utf-8;
       charset utf-8;

       log_format fenxi '$remote_addr|$http_x_forwarded_for|[$time_local]|$http_host|$request|'
                        '$status|$body_bytes_sent|$request_time|$upstream_response_time|$upstream_cache_status|$http_referer|'
                        '$http_user_agent|$upstream_addr';


       #General Options
       server_names_hash_bucket_size 128;
       client_header_buffer_size 32k;
       large_client_header_buffers 4 32k;
       client_body_buffer_size    8m; #256k
       #
       #server_tokens off;
       ignore_invalid_headers   on;
       recursive_error_pages    on;
       server_name_in_redirect off;

       sendfile                 on;

       #timeouts
       keepalive_timeout 60;
       #test
       #client_body_timeout   3m;
       #client_header_timeout 3m;
       #send_timeout          3m;


       #TCP Options
       tcp_nopush  on;
       tcp_nodelay on;

       #fastcgi options
       fastcgi_connect_timeout 300;
       fastcgi_send_timeout 300;
       fastcgi_read_timeout 300;
       fastcgi_buffer_size 64k;
       fastcgi_buffers 4 64k;
       fastcgi_busy_buffers_size 128k;
       fastcgi_temp_file_write_size 128k;

       #set_real_ip_from  10.159.191.0/24;
       #real_ip_header X-Forwarded-For;

       #hiden php version
       fastcgi_hide_header X-Powered-By;

       #size limits
       client_max_body_size       50m;

       gzip on;
       gzip_min_length  1k;
       gzip_buffers     4 16k;
       #gzip_http_version 1.0;
       gzip_comp_level 2;
       gzip_types       text/plain application/x-javascript text/css application/xml application/json;
       gzip_vary on;



        fastcgi_temp_path          /dev/shm/fastcgi_temp;
        client_body_temp_path      /dev/shm/client_body_temp;

        # where the lua package exists
        lua_package_path "/Data/local/openresty-1.9.15.1/nginx/conf/lua/?.lua;;";
        init_by_lua_file "conf/lua/init_lua.lua";

	#brower service
bblu authored
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
  upstream brower {
      server 172.31.30.129:8092;
      server 172.31.30.128:8092;
  }


    upstream union {
          server  172.31.16.99:8088;
    }


    upstream activityApi{
          server 172.31.18.86:8090;
          server 172.31.18.87:8090;
    }



     upstream apiWechat {
          server 172.31.31.13:8094 ;
     }
zhouxiang authored
115 116 117


    upstream apigateway {
bblu authored
118
bblu authored
119 120
        {@{#each ips}@}server   {@{this}@}:8080  max_fails=5 fail_timeout=3s;
        {@{/each}@}
zhouxiang authored
121 122 123 124
        keepalive 32;
      }

    upstream grayapigateway {
bblu authored
125
zhouxiang authored
126 127
        {@{#each grayips}@}server   {@{this}@}:8080  max_fails=5 fail_timeout=3s;
        {@{/each}@}
bblu authored
128
        keepalive 32;
bblu authored
129 130
     }
zhouxiang authored
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157



    upstream www.yohobuy.com {
          server  www.yohobuy.com;
    }




       #upstream
       fastcgi_next_upstream error timeout invalid_header http_500;

       #limit_zone   limit  $binary_remote_addr  1m;

       #fastcgi cache
       #fastcgi_cache_path /nginxcache levels=1:2 keys_zone=two:10m inactive=1d max_size=3000m;
       #for example just for study! have fun!


       include          vhosts/api.yoho.cn.conf;
       include          vhosts/mapi.yohobuy.com.conf;
       include          vhosts/pay.yohobuy.com.conf;
       include          vhosts/service.yoho.cn.conf;
	   include          vhosts/api_single.yoho.cn.conf;
	   include          vhosts/unknown.conf;
bblu authored
158
 }