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. 【OpenCV】在MacOS上源码编译OpenCV

    前言 在做视觉任务时,我们经常会用到开源视觉库OpenCV,OpenCV是一个基于Apache2.0许可(开源)发行的跨平台计算机视觉和机器学习软件库,它具有C++,Python,Java和MATLA ...

  2. poweroff详解

    linux下poweroff命令详解 reboot.halt.poweroff三条命令意思作用一样 阅读这三个命令的man帮助信息后,发现实现的是相同的功能. 作用: 重启或者关闭系统 语法: reb ...

  3. CentOS安装openGauss2.0.1

    CentOS安装openGauss2.0.1 OpenGauss是一款开源关系型数据库管理系统,采用木兰宽松许可证v2发行.openGauss内核源自PostgreSQL,深度融合华为在数据库领域多年 ...

  4. 深入了解RC4 Drop加密技术

    一.引言 在网络安全领域,加密技术始终是重中之重.随着计算机技术的发展,加密算法也在不断更新换代.RC4(Rivest Cipher 4)加密算法因其高效.简洁的特性,在信息安全领域得到了广泛的应用. ...

  5. 微信小程序常用代码

    在微信小程序中,可以使用 wx.showToast.wx.showLoading 和 wx.showModal 等方法来显示不同类型的提示框 wx.showToast:用于显示一条浮动的提示框,一般用 ...

  6. 手把手带你写Node.JS版本小游戏

    摘要:今天就利用Node.JS为大家带来简单有趣的的剪刀石头布的小游戏. JavaScript的出现催动了前端开发的萌芽,前后端分离促进了Vue.React等开发框架的发展,Weex.React-Na ...

  7. SARIF:DevSecOps工具与平台交互的桥梁

    摘要:静态扫描工具融入在DevSecOps的开发过程中,对提高产品的整体的安全水平发挥着重要的作用.为了获取安全检查能力覆盖的最大化,开发团队通常会引入多个安全扫描工具.为了降低各种分析工具的结果汇总 ...

  8. U2Net基于ModelArts Notbook的仿真实验

    摘要:U2Net是一个优秀的显著性目标检测算法,由Qin Xuebin等人发表在Pattern Recognition 2020期刊[Arxiv].U2Net名称的来源在于其网络结构由两层嵌套的Une ...

  9. 带你了解数仓安全测试的TLS协议

    摘要:SSL/TLS协议是业界常用的加密通信协议,通过该协议可以完成通信双方身份认证,会话密钥协商,通信内容加密和完整性保护. 本文分享自华为云社区<GaussDB(DWS)安全测试之TLS协议 ...

  10. 总结vue3 的一些知识点:Vue.js 安装

    Vue.js 安装 1.独立版本 我们可以在 Vue.js 的官网上直接下载 vue.min.js 并用 <script> 标签引入. 下载 Vue.js 2.使用 CDN 方法 以下推荐 ...