user web;
   
  # One worker process per CPU core.
  worker_processes 8;
   
  # Also set
  # /etc/security/limits.conf
  # web soft nofile 65535
  # web hard nofile 65535
  # /etc/default/nginx
  # ULIMIT="-n 65535"
  worker_rlimit_nofile 65535;
   
  pid /run/nginx.pid;
   
  events {
   
  #
  # Determines how many clients will be served by each worker process.
  # (Max clients = worker_connections * worker_processes)
  # Should be equal to `ulimit -n / worker_processes`
  #
  worker_connections 65535;
   
  #
  # Let each process accept multiple connections.
  # Accept as many connections as possible, after nginx gets notification
  # about a new connection.
  # May flood worker_connections, if that option is set too low.
  #
  multi_accept on;
   
  #
  # Preferred connection method for newer linux versions.
  # Essential for linux, optmized to serve many clients with each thread.
  #
  use epoll;
  }
   
  http {
   
  ##
  # Basic Settings
  ##
   
  #
  # Override some buffer limitations, will prevent DDOS too.
  #
  client_body_buffer_size 10K;
  client_header_buffer_size 1k;
  client_max_body_size 8m;
  large_client_header_buffers 2 1k;
   
  #
  # Timeouts
  # The client_body_timeout and client_header_timeout directives are
  # responsible for the time a server will wait for a client body or
  # client header to be sent after request. If neither a body or header
  # is sent, the server will issue a 408 error or Request time out.
  #
  # The keepalive_timeout assigns the timeout for keep-alive connections
  # with the client. Simply put, Nginx will close connections with the
  # client after this period of time.
  #
  # Finally, the send_timeout is a timeout for transmitting a response
  # to the client. If the client does not receive anything within this
  # time, then the connection will be closed.
  #
   
  #
  # send the client a "request timed out" if the body is not loaded
  # by this time. Default 60.
  #
  client_body_timeout 32;
  client_header_timeout 32;
   
  #
  # Every 60 seconds server broadcasts Sync packets, so 90 is
  # a conservative upper bound.
  #
  keepalive_timeout 90; # default 65
  send_timeout 120; # default 60
   
  #
  # Allow the server to close the connection after a client stops
  # responding.
  # Frees up socket-associated memory.
  #
  reset_timedout_connection on;
   
  #
  # Open file descriptors.
  # Caches information about open FDs, freqently accessed files.
  #
  open_file_cache max=200000 inactive=20s;
  open_file_cache_valid 30s;
  open_file_cache_min_uses 2;
  open_file_cache_errors on;
   
  #
  # Sendfile copies data between one FD and other from within the kernel.
  # More efficient than read() + write(), since the requires transferring
  # data to and from the user space.
  #
  sendfile on;
   
  # Tcp_nopush causes nginx to attempt to send its HTTP response head in one
  # packet, instead of using partial frames. This is useful for prepending
  # headers before calling sendfile, or for throughput optimization.
  tcp_nopush on;
   
  #
  # don't buffer data-sends (disable Nagle algorithm). Good for sending
  # frequent small bursts of data in real time.
  #
  tcp_nodelay on;
   
   
  types_hash_max_size 2048;
   
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
   
  ##
  # Logging Settings
  ##
   
  #
  # Use analytics to track stuff instead of using precious file IO resources.
  # Disabling logging speeds up IO.
  #
  access_log off;
  error_log /root/PROJECTS/logs/error.log crit;
   
  ##
  # Gzip Settings
  ##
   
  gzip on;
  gzip_disable "MSIE [1-6]\.";
   
  # Only allow proxy request with these headers to be gzipped.
  gzip_proxied expired no-cache no-store private auth;
   
  # Default is 6 (1<n<9), but 2 -- even 1 -- is enough. The higher it is, the
  # more CPU cycles will be wasted.
  gzip_comp_level 9;
  gzip_min_length 500; # Default 20
   
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
   
  ##
  # Virtual Host Configs
  ##
   
  include /etc/nginx/conf.d/*.conf;
  }

[转帖]高并发下nginx配置模板的更多相关文章

  1. nginx配置模板问题404

    nginx配置模板问题 一.nginx主配置文件如下 cat /etc/nginx/nginx.conf user nginx; worker_processes ; #error_log logs/ ...

  2. 阿里云Linux CentOS8.1 64位服务器安装LNMP(Linux+Nginx+MySQL+PHP) 并发调试之Nginx配置

    搭建好LNMP环境之后,接着要考虑的就是整个系统的并发能力了. 一.Nginx的配置 Nginx有很好的并发能力.但是要想使它的并发能力能够施展出来,需要在初步安装好的Nginx上做一些配置.主要需要 ...

  3. GitLab 配置模板

    GitLab 配置模板 GitLab 使用模板和参数生成配置文件. 一般来说,我们会通过 gitlab.rb 文件修改配置,例如 Nginx 相关配置. gitlab.rb 只能使用特定的几个 Ngi ...

  4. 高并发下的 Nginx 优化与负载均衡

    高并发下的 Nginx 优化   英文原文:Optimizing Nginx for High Traffic Loads 过去谈过一些关于Nginx的常见问题; 其中有一些是关于如何优化Nginx. ...

  5. 高并发下的Nginx优化

    高并发下的Nginx优化 2014-08-08 13:30 mood Nginx    过去谈过一些关于Nginx的常见问题; 其中有一些是关于如何优化Nginx. 很多Nginx新用户是从Apach ...

  6. JAVA跨域、RestTemplate高并发下异常与配置、JSON数据Long转String

    ## 跨域支持 import org.springframework.context.annotation.Bean; import org.springframework.context.annot ...

  7. Nginx 配置实例-配置高可用

    Nginx 配置实例-配置高可用 1. 实现效果 2. 两台机器 nginx 的安装 2.1 192.168.25.120 中 nginx 的安装 2.1.1 安装 pcre 依赖 2.1.2 安装其 ...

  8. [转帖]nginx配置ssl加密(单/双向认证、部分https)

    nginx配置ssl加密(单/双向认证.部分https) https://segmentfault.com/a/1190000002866627   nginx下配置ssl本来是很简单的,无论是去认证 ...

  9. [转帖]nginx配置ssl证书实现https访问

    https://www.cnblogs.com/tianhei/p/7726505.html 今天就是如此处理的 感觉挺不错的. 一,环境说明 服务器系统:ubuntu16.04LTS 服务器IP地址 ...

  10. CentOS7.1下生产环境Keepalived+Nginx配置

    CentOS7.1下生产环境Keepalived+Nginx配置 [日期:2015-07-20] 来源:Linux社区  作者:soulful [字体:大 中 小]   注:下文涉及到配置的,如无特别 ...

随机推荐

  1. 某RBAC管理系统审计

    某RBAC管理系统审计 前言 这个管理系统的审计我去年就开始了但烂尾了,那时候太热闹了log4j2,cs的cve反制等等.这个都给忘了,所以本篇可能有些图有点老,现在就是旧图没一个个换遇到的新的就加上 ...

  2. Shell脚本实践总结

    对比大小 符号用法:(必须使用双括号) < 小于     (( "$a" < "$b" ))  <= 小于等于   (( "$a&q ...

  3. Redis系列(二):解读redis.conf文件、配置、初步使用

    一.解读redis.conf配置文件 # redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位, # 通常的格式就是 1k 5gb 4m 等酱紫: # # 1k =&g ...

  4. LeetCode206反转链表、24两两交换节点

    206. 反转链表 反转一个单链表. 示例: 输入: 1->2->3->4->5->NULL 输出: 5->4->3->2->1->NULL ...

  5. 云图说|AppCube零代码,开启无码新生活

    阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要: 应用魔方 App ...

  6. 不信谣不传谣,亲自动手验证ModelBox推理是否真的“高性能”

    摘要:"高性能推理"是ModelBox宣传的主要特性之一,不信谣不传谣的我决定通过原生API和ModelBox实现相同案例进行对比,看一下ModelBox推理是否真的"高 ...

  7. 2023年 CISO 需要高度关注的任务和趋势

    在过去的几年中,企业一直忙于应对远程办公模式下的安全要求.展望2023年,疫情局面将与过去3年大不相同.根据目前的趋势,未来一年的网络攻击的数量和严重程度都将增加,这将对各规模企业,尤其是未做好准备的 ...

  8. 创建一个科学决策必备的A/B实验,都需要哪些准备?——火山引擎 DataTester 使用指南

    更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流 DataTester 是火山引擎数智平台旗下产品,能基于先进的底层算法,提供科学分流能力和智能的统计引擎,支持多种复 ...

  9. Go--日志

    一.Logger go语言默认提供的日志功能,包为ttps://golang.org/pkg/log/ 优势: 使用非常简单,可以设置任何io.Writer作为日志记录输出并向其发送要写入的日志 劣势 ...

  10. 【辅助工具】Maven使用

    Maven使用 错误排查 查看对应依赖在仓库中的路径,jar文件有没有下载成功,如果不成功直接把外部文件夹删除重新加载 导包错误 找到对应的路径,丛正常导入的同事直接复制过来. Maven启动项目 导 ...