nginx.conf 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # run nginx in foreground
  2. daemon off;
  3. user root;
  4. # Set number of worker processes automatically based on number of CPU cores.
  5. worker_processes auto;
  6. # Enables the use of JIT for regular expressions to speed-up their processing.
  7. pcre_jit on;
  8. error_log /data/logs/error.log warn;
  9. # Includes files with directives to load dynamic modules.
  10. include /etc/nginx/modules/*.conf;
  11. events {
  12. worker_connections 1024;
  13. }
  14. http {
  15. include /etc/nginx/mime.types;
  16. default_type application/octet-stream;
  17. sendfile on;
  18. server_tokens off;
  19. tcp_nopush on;
  20. tcp_nodelay on;
  21. client_body_temp_path /tmp/nginx/body 1 2;
  22. keepalive_timeout 65;
  23. ssl_prefer_server_ciphers on;
  24. gzip on;
  25. proxy_ignore_client_abort off;
  26. client_max_body_size 2000m;
  27. server_names_hash_bucket_size 64;
  28. proxy_http_version 1.1;
  29. proxy_set_header X-Forwarded-Scheme $scheme;
  30. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  31. proxy_set_header Accept-Encoding "";
  32. proxy_cache off;
  33. proxy_cache_path /var/lib/nginx/cache/public levels=1:2 keys_zone=public-cache:30m max_size=192m;
  34. proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
  35. # MISS
  36. # BYPASS
  37. # EXPIRED - expired, request was passed to backend
  38. # UPDATING - expired, stale response was used due to proxy/fastcgi_cache_use_stale updating
  39. # STALE - expired, stale response was used due to proxy/fastcgi_cache_use_stale
  40. # HIT
  41. # - (dash) - request never reached to upstream module. Most likely it was processed at Nginx-level only (e.g. forbidden, redirects, etc) (Ref: Mail Thread
  42. log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"';
  43. log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"';
  44. access_log /data/logs/default.log proxy;
  45. # Dynamically generated resolvers file
  46. include /etc/nginx/conf.d/include/resolvers.conf;
  47. # Default upstream scheme
  48. map $host $forward_scheme {
  49. default http;
  50. }
  51. # Real IP Determination
  52. # Docker subnet:
  53. set_real_ip_from 172.0.0.0/8;
  54. # NPM generated CDN ip ranges:
  55. include conf.d/include/ip_ranges.conf;
  56. # always put the following 2 lines after ip subnets:
  57. real_ip_header X-Forwarded-For;
  58. real_ip_recursive on;
  59. # Files generated by NPM
  60. include /etc/nginx/conf.d/*.conf;
  61. include /data/nginx/default_host/*.conf;
  62. include /data/nginx/proxy_host/*.conf;
  63. include /data/nginx/redirection_host/*.conf;
  64. include /data/nginx/dead_host/*.conf;
  65. include /data/nginx/temp/*.conf;
  66. }
  67. stream {
  68. # Files generated by NPM
  69. include /data/nginx/stream/*.conf;
  70. }