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. Python 潮流周刊第 33 期(摘要)

    本周刊由 Python猫 出品,精心筛选国内外的 250+ 信息源,为你挑选最值得分享的文章.教程.开源项目.软件工具.播客和视频.热门话题等内容.愿景:帮助所有读者精进 Python 技术,并增长职 ...

  2. Rust 学习笔记

    rust 学习梳理 数据类型 基于已明确的类型,Rust会推断剩下大部分类型.基于类型推断Rust具备了与动态类型语言近似的易读性,并仍能在编译期捕获类型错误. 函数可以是泛型的:单个函数ujiu可以 ...

  3. 22、Scaffold属性 抽屉菜单Drawer

    在Scaffold组件里面传入drawer参数可以定义左侧边栏,传入endDrawer可以定义右侧边栏.侧边栏默 认是隐藏的,我们可以通过手指滑动显示侧边栏,也可以通过点击按钮显示侧边栏. class ...

  4. 详解数据库SQL中的三个语句:DROP、TRUNCATE 、DELETE

    本文分享自华为云社区<GaussDB数据库SQL系列-DROP & TRUNCATE & DELETE>,作者:Gauss松鼠会小助手2 . 一.前言 在数据库中,SQL作 ...

  5. 再谈BOM和DOM(5):各个大流浪器DOM和BOM里面的那些坑—兼容性

    三大不冒泡事件 所有浏览器的focus/blur事件都不冒泡,万幸的是大部分浏览器支持focusin/focusout事件,不过可恶的firefox连这个都不支持. IE6.7.8下 submit事件 ...

  6. 【终极教程】Cocos2dx服务端重构(优化cocos2dx服务端)

    [终极教程]Cocos2dx服务端重构(优化cocos2dx服务端) 文章目录 概述 问题概述1. 代码混淆代码加密具体步骤测试和配置阶段IPA 重签名操作步骤2. 缺乏文档3. 缺乏推荐的最佳实践4 ...

  7. 一文快速了解火山引擎 A/B 测试平台

    更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群 一. 概述 A/B Testing 作为因果推断的「黄金标准」,是效果评估的利器. 火山引擎 A/B 测试(Dat ...

  8. Java 剑指offer(16) 打印1到最大的n位数

    题目 输入数字n,按顺序打印出从1最大的n位十进制数.比如输入3,则打印出1.2.3一直到最大的3位数即999. 思路 陷阱: n过大时是大数问题,不能简单用int或者long数据输出,需要采用字符串 ...

  9. 奶瓶KeyBoard | N68键盘使用说明

    1.旋钮功能及操作说明 旋钮功能向下长按5秒按为音量调节/灯光亮度调节互换,顺时针方向为音量+/亮度加,逆时针方向为音量-/亮度减 2. 无线连接及操作说明 Tab按键右侧和Q按键中间为通道连接指示灯 ...

  10. 5 Englishi 词根

    词根 1 ced/cess = go 行走 precede    pre=before   ced =go unprecedentedly  un   pre  ced +ed变成adj  +ly 变 ...