nginx.conf.j2 1.91 KB
#worker_processes  1;



user  www www;

worker_processes 4;
worker_cpu_affinity 00000001 00000010 00000100 00001000;

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


events {
    worker_connections  1024;
}


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

       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|'
                        '$real_ip|$request_api_method|$request_uid|$request_udid';


     # limit req configuration   limit for 20r/s for every ip
     limit_req_zone $binary_remote_addr zone=limit_ufo:30m rate=20r/s;


    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  180;
    client_max_body_size 600m;
    #gzip  on;
    proxy_buffer_size  128k;  
    proxy_buffers   32 32k;  
    proxy_busy_buffers_size 128k;  

    server {
        listen       80;
        server_name  localhost;


        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


 #ufo-gateway
 upstream ufogateway {
    {% for i in groups['java-ufo-fore'] %}
      server {{ i }}:8080 max_fails=5  fail_timeout=3s;
    {% endfor %}
      keepalive 32;
  }


  # ufo-gateway
  upstream ufoplatform {
    {% for i in groups['java-ufo-platform'] %}
      server {{ i }}:8088 max_fails=5  fail_timeout=3s;
    {% endfor %}

      keepalive 100;
  }


	include vhosts/*.conf;

}