nginx.conf 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 208.67.222.222 208.67.220.220;
  24. # Don't tell nginx version to clients.
  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.
  30. client_max_body_size 1m;
  31. # Timeout for keep-alive connections. Server will close connections after
  32. # this time.
  33. keepalive_timeout 65;
  34. # Sendfile copies data between one FD and other from within the kernel,
  35. # which is more efficient than read() + write().
  36. sendfile on;
  37. # Don't buffer data-sends (disable Nagle algorithm).
  38. # Good for sending frequent small bursts of data in real time.
  39. tcp_nodelay on;
  40. # Causes nginx to attempt to send its HTTP response head in one packet,
  41. # instead of using partial frames.
  42. #tcp_nopush on;
  43. # Path of the file with Diffie-Hellman parameters for EDH ciphers.
  44. #ssl_dhparam /etc/ssl/nginx/dh2048.pem;
  45. # Specifies that our cipher suits should be preferred over client ciphers.
  46. #ssl_prefer_server_ciphers on;
  47. # Enables a shared SSL cache with size that can hold around 8000 sessions.
  48. ssl_session_cache shared:SSL:2m;
  49. # 全局SSL配置
  50. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  51. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  52. # Enable gzipping of responses.
  53. #gzip on;
  54. # Set the Vary HTTP header as defined in the RFC 2616.
  55. gzip_vary on;
  56. # Enable checking the existence of precompressed files.
  57. #gzip_static on;
  58. # Specifies the main log format.
  59. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  60. '$status $body_bytes_sent "$http_referer" '
  61. '"$http_user_agent" "$http_x_forwarded_for"';
  62. # Sets the path, format, and configuration for a buffered log write.
  63. access_log /var/log/nginx/access.log main;
  64. # Includes virtual hosts configs.
  65. include /etc/nginx/conf.d/*.conf;
  66. }