nginx.conf 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # run nginx in foreground
  2. daemon off;
  3. pid /run/nginx/nginx.pid;
  4. user npm;
  5. # Set number of worker processes automatically based on number of CPU cores.
  6. worker_processes auto;
  7. # Enables the use of JIT for regular expressions to speed-up their processing.
  8. pcre_jit on;
  9. error_log /data/logs/fallback_error.log warn;
  10. # Includes files with directives to load dynamic modules.
  11. include /etc/nginx/modules/*.conf;
  12. # Custom
  13. include /data/nginx/custom/root_top[.]conf;
  14. events {
  15. include /data/nginx/custom/events[.]conf;
  16. }
  17. http {
  18. include /etc/nginx/mime.types;
  19. default_type application/octet-stream;
  20. sendfile on;
  21. server_tokens off;
  22. tcp_nopush on;
  23. tcp_nodelay on;
  24. client_body_temp_path /tmp/nginx/body 1 2;
  25. keepalive_timeout 90s;
  26. proxy_connect_timeout 90s;
  27. proxy_send_timeout 90s;
  28. proxy_read_timeout 90s;
  29. ssl_prefer_server_ciphers on;
  30. gzip on;
  31. proxy_ignore_client_abort off;
  32. client_max_body_size 2000m;
  33. server_names_hash_bucket_size 1024;
  34. proxy_http_version 1.1;
  35. proxy_set_header X-Forwarded-Scheme $scheme;
  36. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  37. proxy_set_header Accept-Encoding "";
  38. proxy_cache off;
  39. proxy_cache_path /var/lib/nginx/cache/public levels=1:2 keys_zone=public-cache:30m max_size=192m;
  40. proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
  41. # Log format and fallback log file
  42. include /etc/nginx/conf.d/include/log-proxy[.]conf;
  43. # Dynamically generated resolvers file
  44. include /etc/nginx/conf.d/include/resolvers[.]conf;
  45. # Default upstream scheme
  46. map $host $forward_scheme {
  47. default http;
  48. }
  49. # Handle upstream X-Forwarded-Proto and X-Forwarded-Scheme header
  50. map $http_x_forwarded_proto $x_forwarded_proto {
  51. "http" "http";
  52. "https" "https";
  53. default $scheme;
  54. }
  55. map $http_x_forwarded_scheme $x_forwarded_scheme {
  56. "http" "http";
  57. "https" "https";
  58. default $scheme;
  59. }
  60. # Real IP Determination
  61. # Local subnets:
  62. set_real_ip_from 10.0.0.0/8;
  63. set_real_ip_from 172.16.0.0/12; # Includes Docker subnet
  64. set_real_ip_from 192.168.0.0/16;
  65. # NPM generated CDN ip ranges:
  66. include conf.d/include/ip_ranges[.]conf;
  67. # always put the following 2 lines after ip subnets:
  68. real_ip_header X-Real-IP;
  69. real_ip_recursive on;
  70. # Custom
  71. include /data/nginx/custom/http_top[.]conf;
  72. # Files generated by NPM
  73. include /etc/nginx/conf.d/*.conf;
  74. include /data/nginx/default_host/*.conf;
  75. include /data/nginx/proxy_host/*.conf;
  76. include /data/nginx/redirection_host/*.conf;
  77. include /data/nginx/dead_host/*.conf;
  78. include /data/nginx/temp/*.conf;
  79. # Custom
  80. include /data/nginx/custom/http[.]conf;
  81. }
  82. stream {
  83. # Log format and fallback log file
  84. include /etc/nginx/conf.d/include/log-stream[.]conf;
  85. # Files generated by NPM
  86. include /data/nginx/stream/*.conf;
  87. # Custom
  88. include /data/nginx/custom/stream[.]conf;
  89. }
  90. # Custom
  91. include /data/nginx/custom/root[.]conf;