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.

8 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # nginx Configuration File
  2. # http://wiki.nginx.org/Configuration
  3. # Run as a less privileged user for security reasons.
  4. # user www www;
  5. # How many worker threads to run;
  6. # "auto" sets it to the number of CPU cores available in the system, and
  7. # offers the best performance. Don't set it higher than the number of CPU
  8. # cores if changing this parameter.
  9. # The maximum number of connections for Nginx is calculated by:
  10. # max_clients = worker_processes * worker_connections
  11. worker_processes auto;
  12. # Maximum open file descriptors per process;
  13. # should be > worker_connections.
  14. worker_rlimit_nofile 8192;
  15. events {
  16. # When you need > 8000 * cpu_cores connections, you start optimizing your OS,
  17. # and this is probably the point at which you hire people who are smarter than
  18. # you, as this is *a lot* of requests.
  19. worker_connections 8000;
  20. }
  21. # Default error log file
  22. # (this is only used when you don't override error_log on a server{} level)
  23. error_log /var/log/nginx/error.log warn;
  24. pid /var/run/nginx.pid;
  25. http {
  26. # Hide nginx version information.
  27. server_tokens off;
  28. # Define the MIME types for files.
  29. include mime.types;
  30. default_type application/octet-stream;
  31. # Update charset_types due to updated mime.types
  32. charset_types text/css text/plain text/vnd.wap.wml application/javascript application/json application/rss+xml application/xml;
  33. # Format to use in log files
  34. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  35. '$status $body_bytes_sent "$http_referer" '
  36. '"$http_user_agent" "$http_x_forwarded_for"';
  37. # Default log file
  38. # (this is only used when you don't override access_log on a server{} level)
  39. access_log /var/log/nginx/access.log main;
  40. # How long to allow each connection to stay idle; longer values are better
  41. # for each individual client, particularly for SSL, but means that worker
  42. # connections are tied up longer. (Default: 65)
  43. keepalive_timeout 20;
  44. # Speed up file transfers by using sendfile() to copy directly
  45. # between descriptors rather than using read()/write().
  46. # For performance reasons, on FreeBSD systems w/ ZFS
  47. # this option should be disabled as ZFS's ARC caches
  48. # frequently used files in RAM by default.
  49. sendfile on;
  50. # Tell Nginx not to send out partial frames; this increases throughput
  51. # since TCP frames are filled up before being sent out. (adds TCP_CORK)
  52. tcp_nopush on;
  53. # Compression
  54. # Enable Gzip compressed.
  55. gzip on;
  56. # Compression level (1-9).
  57. # 5 is a perfect compromise between size and cpu usage, offering about
  58. # 75% reduction for most ascii files (almost identical to level 9).
  59. gzip_comp_level 5;
  60. # Don't compress anything that's already small and unlikely to shrink much
  61. # if at all (the default is 20 bytes, which is bad as that usually leads to
  62. # larger files after gzipping).
  63. gzip_min_length 256;
  64. # Compress data even for clients that are connecting to us via proxies,
  65. # identified by the "Via" header (required for CloudFront).
  66. gzip_proxied any;
  67. # Tell proxies to cache both the gzipped and regular version of a resource
  68. # whenever the client's Accept-Encoding capabilities header varies;
  69. # Avoids the issue where a non-gzip capable client (which is extremely rare
  70. # today) would display gibberish if their proxy gave them the gzipped version.
  71. gzip_vary on;
  72. # Compress all output labeled with one of the following MIME-types.
  73. gzip_types
  74. application/atom+xml
  75. application/javascript
  76. application/json
  77. application/ld+json
  78. application/manifest+json
  79. application/rss+xml
  80. application/vnd.geo+json
  81. application/vnd.ms-fontobject
  82. application/x-font-ttf
  83. application/x-web-app-manifest+json
  84. application/xhtml+xml
  85. application/xml
  86. font/opentype
  87. image/bmp
  88. image/svg+xml
  89. image/x-icon
  90. text/cache-manifest
  91. text/css
  92. text/plain
  93. text/vcard
  94. text/vnd.rim.location.xloc
  95. text/vtt
  96. text/x-component
  97. text/x-cross-domain-policy;
  98. # text/html is always compressed by HttpGzipModule
  99. # This should be turned on if you are going to have pre-compressed copies (.gz) of
  100. # static files available. If not it should be left off as it will cause extra I/O
  101. # for the check. It is best if you enable this in a location{} block for
  102. # a specific directory, or on an individual server{} level.
  103. # gzip_static on;
  104. # Include files in the sites-enabled folder. server{} configuration files should be
  105. # placed in the sites-available folder, and then the configuration should be enabled
  106. # by creating a symlink to it in the sites-enabled folder.
  107. # See doc/sites-enabled.md for more info.
  108. include conf.d/*.conf;
  109. }