nginx.conf 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 90s;
  23. proxy_connect_timeout 90s;
  24. proxy_send_timeout 90s;
  25. proxy_read_timeout 90s;
  26. ssl_prefer_server_ciphers on;
  27. gzip on;
  28. proxy_ignore_client_abort off;
  29. client_max_body_size 2000m;
  30. server_names_hash_bucket_size 1024;
  31. proxy_http_version 1.1;
  32. proxy_set_header X-Forwarded-Scheme $scheme;
  33. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  34. proxy_set_header Accept-Encoding "";
  35. proxy_cache off;
  36. proxy_cache_path /var/lib/nginx/cache/public levels=1:2 keys_zone=public-cache:30m max_size=192m;
  37. proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
  38. 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"';
  39. 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"';
  40. access_log /data/logs/default.log proxy;
  41. # Dynamically generated resolvers file
  42. include /etc/nginx/conf.d/include/resolvers.conf;
  43. # Default upstream scheme
  44. map $host $forward_scheme {
  45. default http;
  46. }
  47. # Real IP Determination
  48. # Docker subnet:
  49. set_real_ip_from 172.0.0.0/8;
  50. # Local subnets:
  51. set_real_ip_from 10.0.0.0/8;
  52. set_real_ip_from 192.0.0.0/8;
  53. # NPM generated CDN ip ranges:
  54. include conf.d/include/ip_ranges.conf;
  55. # always put the following 2 lines after ip subnets:
  56. real_ip_header X-Forwarded-For;
  57. real_ip_recursive on;
  58. # Files generated by NPM
  59. include /etc/nginx/conf.d/*.conf;
  60. include /data/nginx/default_host/*.conf;
  61. include /data/nginx/proxy_host/*.conf;
  62. include /data/nginx/redirection_host/*.conf;
  63. include /data/nginx/dead_host/*.conf;
  64. include /data/nginx/temp/*.conf;
  65. # Custom
  66. include /data/nginx/custom/http[.]conf;
  67. }
  68. stream {
  69. # Files generated by NPM
  70. include /data/nginx/stream/*.conf;
  71. }
  72. # Custom
  73. include /data/nginx/custom/root[.]conf;