nginx.conf 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # /etc/nginx/nginx.conf
  2. user nginx;
  3. # Set number of worker processes automatically based on number of CPU cores.
  4. worker_processes auto;
  5. # Enables the use of JIT for regular expressions to speed-up their processing.
  6. pcre_jit on;
  7. # Configures default error logger.
  8. error_log /var/log/nginx/error.log warn;
  9. # Includes files with directives to load dynamic modules.
  10. include /etc/nginx/modules/*.conf;
  11. events {
  12. # The maximum number of simultaneous connections that can be opened by
  13. # a worker process.
  14. worker_connections 1024;
  15. }
  16. http {
  17. # Includes mapping of file name extensions to MIME types of responses
  18. # and defines the default type.
  19. include /etc/nginx/mime.types;
  20. default_type application/octet-stream;
  21. # Name servers used to resolve names of upstream servers into addresses.
  22. # It's also needed when using tcpsocket and udpsocket in Lua modules.
  23. #resolver 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001;
  24. # Don't tell nginx version to the clients. Default is 'on'.
  25. server_tokens off;
  26. # Specifies the maximum accepted body size of a client request, as
  27. # indicated by the request header Content-Length. If the stated content
  28. # length is greater than this size, then the client receives the HTTP
  29. # error code 413. Set to 0 to disable. Default is '1m'.
  30. client_max_body_size 1m;
  31. # Sendfile copies data between one FD and other from within the kernel,
  32. # which is more efficient than read() + write(). Default is off.
  33. sendfile on;
  34. # Causes nginx to attempt to send its HTTP response head in one packet,
  35. # instead of using partial frames. Default is 'off'.
  36. tcp_nopush on;
  37. # Enables the specified protocols. Default is TLSv1 TLSv1.1 TLSv1.2.
  38. # TIP: If you're not obligated to support ancient clients, remove TLSv1.1.
  39. ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
  40. # Path of the file with Diffie-Hellman parameters for EDH ciphers.
  41. # TIP: Generate with: `openssl dhparam -out /etc/ssl/nginx/dh2048.pem 2048`
  42. #ssl_dhparam /etc/ssl/nginx/dh2048.pem;
  43. # Specifies that our cipher suits should be preferred over client ciphers.
  44. # Default is 'off'.
  45. ssl_prefer_server_ciphers on;
  46. # Enables a shared SSL cache with size that can hold around 8000 sessions.
  47. # Default is 'none'.
  48. ssl_session_cache shared:SSL:2m;
  49. # Specifies a time during which a client may reuse the session parameters.
  50. # Default is '5m'.
  51. ssl_session_timeout 1h;
  52. # Disable TLS session tickets (they are insecure). Default is 'on'.
  53. ssl_session_tickets off;
  54. # Enable gzipping of responses.
  55. #gzip on;
  56. # Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
  57. gzip_vary on;
  58. # Helper variable for proxying websockets.
  59. map $http_upgrade $connection_upgrade {
  60. default upgrade;
  61. '' close;
  62. }
  63. # Specifies the main log format.
  64. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  65. '$status $body_bytes_sent "$http_referer" '
  66. '"$http_user_agent" "$http_x_forwarded_for"';
  67. # Sets the path, format, and configuration for a buffered log write.
  68. access_log /var/log/nginx/access.log main;
  69. # Includes virtual hosts configs.
  70. include /etc/nginx/http.d/*.conf;
  71. # WARNING: Don't use this directory for virtual hosts anymore.
  72. # This include will be moved to the root context in Alpine 3.14.
  73. #include /etc/nginx/conf.d/*.conf;
  74. }
  75. # TIP: Uncomment if you use stream module.
  76. #include /etc/nginx/stream.conf;