You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.6 KiB

  1. user www-data;
  2. worker_processes auto;
  3. worker_cpu_affinity auto;
  4. worker_rlimit_nofile 100000;
  5. pid /run/nginx.pid;
  6. events
  7. {
  8. worker_connections 16384;
  9. multi_accept on;
  10. use epoll;
  11. }
  12. http
  13. {
  14. ##
  15. # EasyEngine Settings
  16. ##
  17. sendfile on;
  18. sendfile_max_chunk 512k;
  19. tcp_nopush on;
  20. tcp_nodelay on;
  21. keepalive_timeout 8;
  22. keepalive_requests 500;
  23. lingering_time 20s;
  24. lingering_timeout 5s;
  25. server_tokens off;
  26. reset_timedout_connection on;
  27. add_header X-Powered-By "EasyEngine v3.8.1 - Optimized by VirtuBox";
  28. add_header rt-Fastcgi-Cache $upstream_cache_status;
  29. # Limit Request
  30. limit_req_status 403;
  31. limit_req_zone $remote_addr_ipscrub zone=one:10m rate=1r/s;
  32. #Simple DOS mitigation
  33. ##Max c/s by ip
  34. #limit_conn_zone $binary_remote_addr zone=limit_per_ip:10m;
  35. #limit_conn limit_per_ip 80;
  36. ##Max rq/s by ip
  37. #limit_req_zone $binary_remote_addr zone=allips:10m rate=400r/s;
  38. #limit_req zone=allips burst=400 nodelay;
  39. # Proxy Settings
  40. # set_real_ip_from proxy-server-ip;
  41. # real_ip_header X-Forwarded-For;
  42. fastcgi_read_timeout 300;
  43. client_max_body_size 100m;
  44. #See - https://www.nginx.com/blog/thread-pools-boost-performance-9x/
  45. aio threads;
  46. # tls dynamic records patch directive
  47. ssl_dyn_rec_enable on;
  48. ssl_dyn_rec_enable on;
  49. ssl_dyn_rec_size_hi 4229;
  50. ssl_dyn_rec_size_lo 1369;
  51. ssl_dyn_rec_threshold 40;
  52. ssl_dyn_rec_timeout 1000;
  53. # nginx-vts-status module
  54. vhost_traffic_status_zone;
  55. resolver 8.8.8.8 1.1.1.1 valid=300s;
  56. resolver_timeout 10;
  57. ##
  58. # GeoIP module configuration, before removing comments
  59. # read the tutorial : https://gist.github.com/VirtuBox/9ed03c9bd9169202c358a8be181b7840
  60. ##
  61. #geoip_country /usr/share/GeoIP/GeoIP.dat;
  62. #geoip_city /usr/share/GeoIP/GeoIPCity.dat;
  63. ##
  64. # SSL Settings
  65. ##
  66. # intermediate configuration. tweak to your needs.
  67. ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  68. ssl_ciphers 'TLS13+AESGCM+AES128:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
  69. ssl_prefer_server_ciphers on;
  70. ssl_session_cache shared:SSL:50m;
  71. ssl_session_timeout 1d;
  72. ssl_session_tickets off;
  73. ssl_ecdh_curve X25519:sect571r1:secp521r1:secp384r1;
  74. ##Common headers for security
  75. more_set_headers "X-Frame-Options : SAMEORIGIN";
  76. more_set_headers "X-Xss-Protection : 1; mode=block";
  77. more_set_headers "X-Content-Type-Options : nosniff";
  78. more_set_headers "Referrer-Policy : strict-origin-when-cross-origin";
  79. ##
  80. # Basic Settings
  81. ##
  82. # server_names_hash_bucket_size 64;
  83. # server_name_in_redirect off;
  84. include /etc/nginx/mime.types;
  85. default_type application/octet-stream;
  86. ##
  87. # Logging Settings
  88. # access_log disabled for performance
  89. ##
  90. access_log off;
  91. error_log /var/log/nginx/error.log;
  92. # Log format Settings
  93. log_format rt_cache '$remote_addr_ipscrub $upstream_response_time $upstream_cache_status [$time_local] '
  94. '$http_host "$request" $status $body_bytes_sent '
  95. '"$http_referer" "$http_user_agent" $server_protocol';
  96. # ipscrub settings
  97. ipscrub_period_seconds 3600;
  98. ##
  99. # Gzip Settings
  100. ##
  101. gzip on;
  102. gzip_disable "msie6";
  103. gzip_vary on;
  104. gzip_proxied any;
  105. gzip_comp_level 6;
  106. gzip_buffers 16 8k;
  107. gzip_http_version 1.1;
  108. gzip_types
  109. application/atom+xml
  110. application/javascript
  111. application/json
  112. application/rss+xml
  113. application/vnd.ms-fontobject
  114. application/x-font-ttf
  115. application/x-web-app-manifest+json
  116. application/xhtml+xml
  117. application/xml
  118. font/opentype
  119. image/svg+xml
  120. image/x-icon
  121. text/css
  122. text/plain
  123. text/x-component
  124. text/xml
  125. text/javascript;
  126. ##
  127. # Brotli Settings
  128. ##
  129. brotli on;
  130. brotli_static on;
  131. brotli_buffers 16 8k;
  132. brotli_comp_level 4;
  133. brotli_types *;
  134. ##
  135. # Virtual Host Configs
  136. ##
  137. include /etc/nginx/conf.d/*.conf;
  138. include /etc/nginx/sites-enabled/*;
  139. }