nginx.conf 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. set_real_ip_from 0.0.0.0/0;
  22. real_ip_header X-Forwarded-For;
  23. # Name servers used to resolve names of upstream servers into addresses.
  24. # It's also needed when using tcpsocket and udpsocket in Lua modules.
  25. #resolver 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001;
  26. # Don't tell nginx version to the clients. Default is 'on'.
  27. server_tokens off;
  28. # Specifies the maximum accepted body size of a client request, as
  29. # indicated by the request header Content-Length. If the stated content
  30. # length is greater than this size, then the client receives the HTTP
  31. # error code 413. Set to 0 to disable. Default is '1m'.
  32. client_max_body_size 1m;
  33. # Sendfile copies data between one FD and other from within the kernel,
  34. # which is more efficient than read() + write(). Default is off.
  35. sendfile on;
  36. # Causes nginx to attempt to send its HTTP response head in one packet,
  37. # instead of using partial frames. Default is 'off'.
  38. tcp_nopush on;
  39. # Enables the specified protocols. Default is TLSv1 TLSv1.1 TLSv1.2.
  40. # TIP: If you're not obligated to support ancient clients, remove TLSv1.1.
  41. ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
  42. # Path of the file with Diffie-Hellman parameters for EDH ciphers.
  43. # TIP: Generate with: `openssl dhparam -out /etc/ssl/nginx/dh2048.pem 2048`
  44. #ssl_dhparam /etc/ssl/nginx/dh2048.pem;
  45. # Specifies that our cipher suits should be preferred over client ciphers.
  46. # Default is 'off'.
  47. ssl_prefer_server_ciphers on;
  48. # Enables a shared SSL cache with size that can hold around 8000 sessions.
  49. # Default is 'none'.
  50. ssl_session_cache shared:SSL:2m;
  51. # Specifies a time during which a client may reuse the session parameters.
  52. # Default is '5m'.
  53. ssl_session_timeout 1h;
  54. # Disable TLS session tickets (they are insecure). Default is 'on'.
  55. ssl_session_tickets off;
  56. # Enable gzipping of responses.
  57. #gzip on;
  58. # Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
  59. gzip_vary on;
  60. # Helper variable for proxying websockets.
  61. map $http_upgrade $connection_upgrade {
  62. default upgrade;
  63. '' close;
  64. }
  65. # Specifies the main log format.
  66. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  67. '$status $body_bytes_sent "$http_referer" '
  68. '"$http_user_agent" "$http_x_forwarded_for"';
  69. # Sets the path, format, and configuration for a buffered log write.
  70. access_log /var/log/nginx/access.log main;
  71. # Includes virtual hosts configs.
  72. include /etc/nginx/http.d/*.conf;
  73. # WARNING: Don't use this directory for virtual hosts anymore.
  74. # This include will be moved to the root context in Alpine 3.14.
  75. #include /etc/nginx/conf.d/*.conf;
  76. }
  77. # TIP: Uncomment if you use stream module.
  78. #include /etc/nginx/stream.conf;