nginx.conf 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. user www-data;
  2. worker_processes 1; # one(1) worker or equal the number of _real_ cpu cores. 4=4 core cpu
  3. worker_priority 15; # renice workers to reduce priority compared to system processes for
  4. # machine health. worst case nginx will get ~25% system resources at nice=15
  5. pid /run/nginx.pid;
  6. include /etc/nginx/modules-enabled/*.conf;
  7. events {
  8. worker_connections 768;
  9. # multi_accept on;
  10. }
  11. http {
  12. ### Added ###
  13. ## see https://calomel.org/nginx.html
  14. # Timeouts, do not keep connections open longer then necessary to reduce
  15. # resource usage and deny Slowloris type attacks.
  16. client_body_timeout 5s; # maximum time between packets the client can pause when sending nginx any data
  17. client_header_timeout 5s; # maximum time the client has to send the entire header to nginx
  18. keepalive_timeout 75s; # timeout which a single keep-alive client connection will stay open
  19. send_timeout 15s; # maximum time between packets nginx is allowed to pause when sending the client data
  20. ### End Added ###
  21. ### Multiple Connection Attempts ### {{{
  22. ## http://nginx.org/en/docs/http/ngx_http_limit_req_module.html
  23. limit_req_zone $binary_remote_addr zone=perip:10m rate=1r/s;
  24. limit_req_zone $server_name zone=perserver:10m rate=10r/s;
  25. ### End Multiple Connection Attempts ### }}}
  26. ##
  27. # Basic Settings
  28. ##
  29. sendfile on;
  30. tcp_nopush on;
  31. tcp_nodelay on;
  32. #####keepalive_timeout 65;
  33. types_hash_max_size 2048;
  34. server_tokens off;
  35. # server_names_hash_bucket_size 64;
  36. # server_name_in_redirect off;
  37. include /etc/nginx/mime.types;
  38. default_type application/octet-stream;
  39. ##
  40. # SSL Settings
  41. ##
  42. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  43. ssl_prefer_server_ciphers on;
  44. ##
  45. # Logging Settings
  46. ##
  47. access_log /var/log/nginx/access.log;
  48. error_log /var/log/nginx/error.log;
  49. ##
  50. # Gzip Settings
  51. ##
  52. gzip on;
  53. gzip_disable "msie6";
  54. # gzip_vary on;
  55. # gzip_proxied any;
  56. # gzip_comp_level 6;
  57. # gzip_buffers 16 8k;
  58. # gzip_http_version 1.1;
  59. # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  60. ##
  61. # Virtual Host Configs
  62. ##
  63. include /etc/nginx/conf.d/*.conf;
  64. include /etc/nginx/sites-enabled/*;
  65. }