Fix 'nginx say 10000 worker_connections are not enough'
[msb/apigateway.git] / openresty-ext / src / assembly / resources / openresty / nginx / conf / nginx.conf
index 5c524fc..a340aa8 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
+# Copyright (C) 2017-2018 ZTE, Inc. and others. All rights reserved. (ZTE)
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 #
 
 #user  nobody;
-worker_processes  auto;
-worker_rlimit_nofile 50000; 
+worker_processes  8;
+worker_rlimit_nofile 65535;
 
-error_log  logs/error.log  warn;
+error_log  logs/error.log  info;
 pid        logs/nginx.pid;
 
+env ROUTER_SUBDOMAIN;
+env HTTP_OVERWRITE_PORT;
+env HTTPS_OVERWRITE_PORT;
+
 events {
-    #linux下打开提高性能
-    #use epoll; 
-    worker_connections  2048;
-    multi_accept on; 
+       #there is normally no need to specify the following directive explicitly
+       #use epoll;
+       worker_connections  10000;
+       multi_accept off;
 }
 
 http {
-    server_tokens off;
-    include mime.types;
-    default_type text/html; 
+       include mime.types;
+       #default_type text/html; 
 
-    #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_id "$request" '
+                         '$status request_processing_time:$request_time upstream_response_time:$upstream_response_time '
+                         '"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
 
-    #access_log  logs/access.log  main;
-    access_log off; 
+       access_log  logs/access.log  main;
+       #access_log off; 
        
-    sendfile        on;
-    tcp_nopush     on;
+       sendfile       on;
+       tcp_nopush     on;
+       tcp_nodelay    on;
        
-    keepalive_timeout  120s;
+       server_tokens off;
        
-    gzip  on;
-
-    include ../msb-enabled/*.conf;
+       keepalive_timeout 120s;
+    keepalive_requests 200;
+    types_hash_max_size 2048;
+       
+       #open_file_cache max=200000 inactive=300s;
+    #open_file_cache_valid 300s;
+    #open_file_cache_min_uses 2;
+    #open_file_cache_errors on;
+       
+       gzip  on;
+       gzip_min_length 1k;
+        gzip_buffers 4 16k;
+        gzip_comp_level 2;
+        gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml;
+       
+       include ../msb-enabled/*.conf;
        include ../sites-enabled/*.conf;
        include ../sites-enabled-mount/*.conf;
 }
 
 stream {
-    include ../stream-enabled/*;
+       include ../stream-enabled/*.conf;
 }